aspell: add section "option" in aspell.conf for speller options (task #11083)

This commit is contained in:
Sebastien Helleu 2011-04-15 18:45:17 +02:00
parent 377024835a
commit 53cc5af7c5
18 changed files with 326 additions and 11 deletions

View File

@ -46,6 +46,7 @@ Version 0.3.5 (under dev!)
* api: add new functions buffer_match_list and window_search_with_buffer
* plugins: fix memory leaks when setting buffer callbacks after /upgrade
(plugins: irc, relay, xfer, scripts)
* aspell: add section "option" in aspell.conf for speller options (task #11083)
* aspell: fix spellers used after switch of window (bug #32811)
* irc: fix memory leak when copying or renaming server
* irc: do not rejoin channels where /part has been issued before reconnection

View File

@ -871,6 +871,27 @@ Befehle
include::autogen/user/aspell_commands.txt[]
// TRANSLATION MISSING
[[aspell_speller_options]]
Speller options
^^^^^^^^^^^^^^^
Speller options can be defined by adding options in section "option" of aspell
configuration.
The option name is an aspell configuration option. List of options can be found
in a shell with following command:
----------------------------------------
$ aspell config
----------------------------------------
For example, to enable option "ignore-case":
----------------------------------------
/set aspell.option.ignore-case "true"
----------------------------------------
[[charset_plugin]]
Charset Erweiterung
~~~~~~~~~~~~~~~~~~~

View File

@ -74,6 +74,7 @@ my %plugin_list = ("weechat" => "co", "alias" => "",
# options to ignore
my @ignore_options = ("aspell\\.dict\\..*",
"aspell\\.option\\..*",
"charset\\.decode\\..*",
"charset\\.encode\\..*",
"irc\\.msgbuffer\\..*",

View File

@ -861,6 +861,27 @@ Commands
include::autogen/user/aspell_commands.txt[]
[[aspell_speller_options]]
Speller options
^^^^^^^^^^^^^^^
Speller options can be defined by adding options in section "option" of aspell
configuration.
The option name is an aspell configuration option. List of options can be found
in a shell with following command:
----------------------------------------
$ aspell config
----------------------------------------
For example, to enable option "ignore-case":
----------------------------------------
/set aspell.option.ignore-case "true"
----------------------------------------
[[charset_plugin]]
Charset plugin
~~~~~~~~~~~~~~

View File

@ -878,6 +878,26 @@ Commandes
include::autogen/user/aspell_commands.txt[]
[[aspell_speller_options]]
Options du vérificateur d'orthographe
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Les options du vérificateur d'orthographe peuvent être définies en ajoutant des
options dans la section "option" de la configuration aspell.
Le nom de l'option est une option de configuration aspell. La liste des options
peut être trouvée par la commande suivante sous le shell :
----------------------------------------
$ aspell config
----------------------------------------
Par exemple, pour activer l'option "ignore-case":
----------------------------------------
/set aspell.option.ignore-case "true"
----------------------------------------
[[charset_plugin]]
Extension Charset
~~~~~~~~~~~~~~~~~

View File

@ -877,6 +877,27 @@ Comandi
include::autogen/user/aspell_commands.txt[]
// TRANSLATION MISSING
[[aspell_speller_options]]
Speller options
^^^^^^^^^^^^^^^
Speller options can be defined by adding options in section "option" of aspell
configuration.
The option name is an aspell configuration option. List of options can be found
in a shell with following command:
----------------------------------------
$ aspell config
----------------------------------------
For example, to enable option "ignore-case":
----------------------------------------
/set aspell.option.ignore-case "true"
----------------------------------------
[[charset_plugin]]
Plugin Charset
~~~~~~~~~~~~~~

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-10 17:32+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3082,6 +3082,15 @@ msgstr "čárkami oddělený seznam slovníků, které použít pro tento buffer
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s%s: chyba vytvoření aspell slovníku \"%s\" => \"%s\""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s%s: chyba vytvoření aspell slovníku \"%s\" => \"%s\""
msgid "color used for misspelled words"
msgstr "barva použitá pro slova s chybou"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-13 11:29+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-14 10:00+0200\n"
"Last-Translator: Nils G.\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3306,6 +3306,15 @@ msgstr ""
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s%s: Fehler beim Erstellen des aspell-Wörterbuches \"%s\" => \"%s\""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s%s: Fehler beim Erstellen des aspell-Wörterbuches \"%s\" => \"%s\""
msgid "color used for misspelled words"
msgstr ""
"In dieser Farbe wird ein Wort mit einem Rechtschreibfehler hervorgehoben"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-10 17:31+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3159,6 +3159,15 @@ msgstr "lista separada por comas de diccionarios para usar en este buffer"
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s%s: error al crear el diccionario aspell \"%s\" => \"%s\""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s%s: error al crear el diccionario aspell \"%s\" => \"%s\""
msgid "color used for misspelled words"
msgstr "color a usar para palabras mal escritas"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"PO-Revision-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-15 12:02+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@ -3248,6 +3248,17 @@ msgstr ""
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s%s: erreur en création du dictionnaire aspell \"%s\" => \"%s\""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
"option pour aspell (pour la liste des options disponibles et le format, "
"lancer la commande \"aspell config\" dans un shell)"
#, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s%s: erreur en création de l'option aspell \"%s\" => \"%s\""
msgid "color used for misspelled words"
msgstr "couleur utilisée pour les mots mal orthographiés"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-10 11:21+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2864,6 +2864,15 @@ msgstr ""
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s nincs elég memória az információs pult üzenethez\n"
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s nincs elég memória az információs pult üzenethez\n"
msgid "color used for misspelled words"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-10 17:33+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3214,6 +3214,15 @@ msgstr "elenco separato da virgole di dizionari da utilizzare su questo buffer"
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s%s: errore nella creazione del dizionario aspell \"%s\" => \"%s\""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s%s: errore nella creazione del dizionario aspell \"%s\" => \"%s\""
msgid "color used for misspelled words"
msgstr "colore utilizzato per le parole non corrette"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-10 17:32+0200\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3148,6 +3148,15 @@ msgstr "oddzielona przecinkami lista słowników do użycia w tym buforze"
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s%s: błąd podczas tworzenia słownika aspell \"%s\" => \"%s\""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s%s: błąd podczas tworzenia słownika aspell \"%s\" => \"%s\""
msgid "color used for misspelled words"
msgstr "kolor używany dla błędnie zapisanych słów"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-10 11:22+0200\n"
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3012,6 +3012,15 @@ msgstr ""
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr ""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%sErro: incapaz de configurar a opção \"%s\" para a barra \"%s\""
msgid "color used for misspelled words"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: 2011-04-10 17:33+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2883,6 +2883,15 @@ msgstr ""
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr "%s недостаточно памяти для сообщения в строке информации\n"
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr "%s недостаточно памяти для сообщения в строке информации\n"
msgid "color used for misspelled words"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-04-11 11:50+0200\n"
"POT-Creation-Date: 2011-04-15 12:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -2484,6 +2484,15 @@ msgstr ""
msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
msgstr ""
msgid ""
"option for aspell (for list of available options and format, run command "
"\"aspell config\" in a shell)"
msgstr ""
#, c-format
msgid "%s%s: error creating aspell option \"%s\" => \"%s\""
msgstr ""
msgid "color used for misspelled words"
msgstr ""

View File

@ -146,6 +146,7 @@ weechat_aspell_config_dict_delete_option (void *data,
(void) section;
weechat_config_option_free (option);
weechat_aspell_create_spellers (weechat_current_buffer ());
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
@ -220,6 +221,115 @@ weechat_aspell_config_dict_create_option (void *data,
return rc;
}
/*
* weechat_aspell_config_option_change: called when an aspell option is changed
*/
void
weechat_aspell_config_option_change (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
weechat_aspell_speller_free_all ();
weechat_aspell_create_spellers (weechat_current_buffer ());
}
/*
* weechat_aspell_config_option_delete_option: delete option in "option" section
*/
int
weechat_aspell_config_option_delete_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
weechat_config_option_free (option);
weechat_aspell_speller_free_all ();
weechat_aspell_create_spellers (weechat_current_buffer ());
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
/*
* weechat_aspell_config_option_create_option: create option in "option" section
*/
int
weechat_aspell_config_option_create_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
struct t_config_option *ptr_option;
int rc;
/* make C compiler happy */
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
option_name);
if (ptr_option)
{
if (value && value[0])
rc = weechat_config_option_set (ptr_option, value, 1);
else
{
weechat_config_option_free (ptr_option);
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
else
{
if (value && value[0])
{
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string",
_("option for aspell (for list of available options and "
"format, run command \"aspell config\" in a shell)"),
NULL, 0, 0, "", value, 0,
NULL, NULL,
&weechat_aspell_config_option_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
_("%s%s: error creating aspell option \"%s\" => \"%s\""),
weechat_prefix ("error"), ASPELL_PLUGIN_NAME,
option_name, value);
}
else
{
weechat_aspell_speller_free_all ();
weechat_aspell_create_spellers (weechat_current_buffer ());
}
return rc;
}
/*
* weechat_aspell_config_get_dict: get a dictionary list for a buffer
*/
@ -342,6 +452,20 @@ weechat_aspell_config_init ()
weechat_aspell_config_section_dict = ptr_section;
/* option */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "option",
1, 1,
NULL, NULL,
NULL, NULL,
NULL, NULL,
&weechat_aspell_config_option_create_option, NULL,
&weechat_aspell_config_option_delete_option, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
return 0;
}
return 1;
}

View File

@ -131,6 +131,7 @@ weechat_aspell_speller_new (const char *lang)
struct t_aspell_speller *new_speller;
AspellConfig *config;
AspellCanHaveError *ret;
struct t_infolist *infolist;
if (!lang)
return NULL;
@ -145,6 +146,19 @@ weechat_aspell_speller_new (const char *lang)
/* create a speller instance for the newly created cell */
config = new_aspell_config();
aspell_config_replace (config, "lang", lang);
/* apply all options on speller */
infolist = weechat_infolist_get ("option", NULL, "aspell.option.*");
if (infolist)
{
while (weechat_infolist_next (infolist))
{
aspell_config_replace (config,
weechat_infolist_string (infolist, "option_name"),
weechat_infolist_string (infolist, "value"));
}
weechat_infolist_free (infolist);
}
ret = new_aspell_speller (config);