mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #2914 (disable annoying aspell warnings about spelling language)
Added the aspell param 'spell_language' in ini-file. This allow set spelling language. spell_language=NONE - disable aspell support. Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
parent
9f797a4c47
commit
4861d06073
@ -176,14 +176,17 @@ create_command_menu (void)
|
||||
menu_entry_create (_("Record/Repeat &actions"), CK_RepeatStartStopRecord));
|
||||
entries = g_list_prepend (entries, menu_separator_create ());
|
||||
#ifdef HAVE_ASPELL
|
||||
entries = g_list_prepend (entries, menu_entry_create (_("S&pell check"), CK_SpellCheck));
|
||||
entries =
|
||||
g_list_prepend (entries, menu_entry_create (_("C&heck word"), CK_SpellCheckCurrentWord));
|
||||
entries =
|
||||
g_list_prepend (entries,
|
||||
menu_entry_create (_("Change spelling &language..."),
|
||||
CK_SpellCheckSelectLang));
|
||||
entries = g_list_prepend (entries, menu_separator_create ());
|
||||
if (strcmp (spell_language, "NONE") != 0)
|
||||
{
|
||||
entries = g_list_prepend (entries, menu_entry_create (_("S&pell check"), CK_SpellCheck));
|
||||
entries =
|
||||
g_list_prepend (entries, menu_entry_create (_("C&heck word"), CK_SpellCheckCurrentWord));
|
||||
entries =
|
||||
g_list_prepend (entries,
|
||||
menu_entry_create (_("Change spelling &language..."),
|
||||
CK_SpellCheckSelectLang));
|
||||
entries = g_list_prepend (entries, menu_separator_create ());
|
||||
}
|
||||
#endif /* HAVE_ASPELL */
|
||||
entries = g_list_prepend (entries, menu_entry_create (_("&Mail..."), CK_Mail));
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
#endif
|
||||
#include "lib/strutil.h"
|
||||
|
||||
#include "src/setup.h"
|
||||
|
||||
#include "edit-impl.h"
|
||||
#include "spell.h"
|
||||
|
||||
@ -284,6 +286,9 @@ aspell_init (void)
|
||||
{
|
||||
AspellCanHaveError *error = NULL;
|
||||
|
||||
if (strcmp (spell_language, "NONE") == 0)
|
||||
return;
|
||||
|
||||
if (global_speller != NULL)
|
||||
return;
|
||||
|
||||
@ -301,6 +306,13 @@ aspell_init (void)
|
||||
global_speller->config = mc_new_aspell_config ();
|
||||
global_speller->speller = NULL;
|
||||
|
||||
if (spell_language != NULL)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = mc_aspell_config_replace (global_speller->config, "lang", spell_language);
|
||||
}
|
||||
|
||||
error = mc_new_aspell_speller (global_speller->config);
|
||||
|
||||
if (mc_aspell_error_number (error) == 0)
|
||||
@ -435,6 +447,9 @@ aspell_set_lang (const char *lang)
|
||||
AspellCanHaveError *error;
|
||||
const char *spell_codeset;
|
||||
|
||||
g_free (spell_language);
|
||||
spell_language = g_strdup (lang);
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
if (mc_global.source_codepage > 0)
|
||||
spell_codeset = get_codepage_id (mc_global.source_codepage);
|
||||
|
19
src/setup.c
19
src/setup.c
@ -187,6 +187,10 @@ char *autodetect_codeset = NULL;
|
||||
gboolean is_autodetect_codeset_enabled = FALSE;
|
||||
#endif /* !HAVE_CHARSET */
|
||||
|
||||
#ifdef HAVE_ASPELL
|
||||
char *spell_language = NULL;
|
||||
#endif
|
||||
|
||||
/* If set, then print to the given file the last directory we were at */
|
||||
char *last_wd_string = NULL;
|
||||
|
||||
@ -1049,6 +1053,11 @@ load_setup (void)
|
||||
mc_global.utf8_display = str_isutf8 (buffer);
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
#ifdef HAVE_ASPELL
|
||||
spell_language =
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "spell_language", "en");
|
||||
#endif /* HAVE_ASPELL */
|
||||
|
||||
clipboard_store_path =
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_store", "");
|
||||
clipboard_paste_path =
|
||||
@ -1095,6 +1104,12 @@ save_setup (gboolean save_options, gboolean save_panel_options)
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "autodetect_codeset",
|
||||
autodetect_codeset);
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
#ifdef HAVE_ASPELL
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "spell_language",
|
||||
spell_language);
|
||||
#endif /* HAVE_ASPELL */
|
||||
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_store",
|
||||
clipboard_store_path);
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_paste",
|
||||
@ -1142,6 +1157,10 @@ done_setup (void)
|
||||
g_free (autodetect_codeset);
|
||||
free_codepages_list ();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ASPELL
|
||||
g_free (spell_language);
|
||||
#endif /* HAVE_ASPELL */
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -113,6 +113,10 @@ extern char *autodetect_codeset;
|
||||
extern gboolean is_autodetect_codeset_enabled;
|
||||
#endif /* !HAVE_CHARSET */
|
||||
|
||||
#ifdef HAVE_ASPELL
|
||||
extern char *spell_language;
|
||||
#endif
|
||||
|
||||
/* If set, then print to the given file the last directory we were at */
|
||||
extern char *last_wd_string;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user