summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/spell/spell-command.c18
-rw-r--r--src/plugins/spell/spell-completion.c3
-rw-r--r--src/plugins/spell/spell-config.c4
-rw-r--r--src/plugins/spell/spell-speller.c9
4 files changed, 28 insertions, 6 deletions
diff --git a/src/plugins/spell/spell-command.c b/src/plugins/spell/spell-command.c
index dc990f446..9658555f3 100644
--- a/src/plugins/spell/spell-command.c
+++ b/src/plugins/spell/spell-command.c
@@ -216,6 +216,7 @@ void
spell_command_set_dict (struct t_gui_buffer *buffer, const char *value)
{
char *name;
+ int disabled;
name = spell_build_option_name (buffer);
if (!name)
@@ -224,8 +225,16 @@ spell_command_set_dict (struct t_gui_buffer *buffer, const char *value)
if (spell_config_set_dict (name, value) > 0)
{
if (value && value[0])
- weechat_printf (NULL, "%s: \"%s\" => %s",
- SPELL_PLUGIN_NAME, name, value);
+ {
+ disabled = (strcmp (value, "-") == 0);
+ weechat_printf (NULL, "%s: \"%s\" => %s%s%s%s",
+ SPELL_PLUGIN_NAME,
+ name,
+ value,
+ (disabled) ? " (" : "",
+ (disabled) ? _("spell checking disabled") : "",
+ (disabled) ? ")" : "");
+ }
else
weechat_printf (NULL, _("%s: \"%s\" removed"),
SPELL_PLUGIN_NAME, name);
@@ -472,7 +481,7 @@ spell_command_init ()
N_("spell plugin configuration"),
N_("enable|disable|toggle"
" || listdict"
- " || setdict <dict>[,<dict>...]"
+ " || setdict -|<dict>[,<dict>...]"
" || deldict"
" || addword [<dict>] <word>"),
N_(" enable: enable spell checker\n"
@@ -480,7 +489,8 @@ spell_command_init ()
" toggle: toggle spell checker\n"
"listdict: show installed dictionaries\n"
" setdict: set dictionary for current buffer (multiple dictionaries "
- "can be separated by a comma)\n"
+ "can be separated by a comma, the special value \"-\" disables "
+ "spell checking on current buffer)\n"
" deldict: delete dictionary used on current buffer\n"
" addword: add a word in personal dictionary\n"
"\n"
diff --git a/src/plugins/spell/spell-completion.c b/src/plugins/spell/spell-completion.c
index 306f88a3f..4dfacf510 100644
--- a/src/plugins/spell/spell-completion.c
+++ b/src/plugins/spell/spell-completion.c
@@ -116,6 +116,9 @@ spell_completion_dicts_cb (const void *pointer, void *data,
0, WEECHAT_LIST_POS_SORT);
}
+ weechat_completion_list_add (completion, "-",
+ 0, WEECHAT_LIST_POS_BEGINNING);
+
delete_aspell_dict_info_enumeration (elements);
delete_aspell_config (config);
#endif /* USE_ENCHANT */
diff --git a/src/plugins/spell/spell-config.c b/src/plugins/spell/spell-config.c
index f763d0187..1dfbbadeb 100644
--- a/src/plugins/spell/spell-config.c
+++ b/src/plugins/spell/spell-config.c
@@ -255,7 +255,9 @@ spell_config_dict_create_option (const void *pointer, void *data,
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string",
- _("comma separated list of dictionaries to use on this buffer"),
+ _("comma separated list of dictionaries to use on this "
+ "buffer (special value \"-\" disables spell checking "
+ "on this buffer)"),
NULL, 0, 0, "", value, 0,
NULL, NULL, NULL,
&spell_config_dict_change, NULL, NULL,
diff --git a/src/plugins/spell/spell-speller.c b/src/plugins/spell/spell-speller.c
index f8662e0ca..3b3229a27 100644
--- a/src/plugins/spell/spell-speller.c
+++ b/src/plugins/spell/spell-speller.c
@@ -97,6 +97,13 @@ spell_speller_check_dictionaries (const char *dict_list)
char **argv;
int argc, i;
+ if (!dict_list)
+ return;
+
+ /* special value "-" is used to disable spell checking on a buffer */
+ if (strcmp (dict_list, "-") == 0)
+ return;
+
if (dict_list)
{
argv = weechat_string_split (dict_list, ",", NULL,
@@ -381,7 +388,7 @@ spell_speller_buffer_new (struct t_gui_buffer *buffer)
new_speller_buffer->modifier_result = NULL;
buffer_dicts = spell_get_dict (buffer);
- if (buffer_dicts)
+ if (buffer_dicts && (strcmp (buffer_dicts, "-") != 0))
{
dicts = weechat_string_split (buffer_dicts, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT