diff --git a/CMakeLists.txt b/CMakeLists.txt index f678f156d..c832d701d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,6 +166,16 @@ if(ENABLE_TESTS AND NOT ENABLE_HEADLESS) message(FATAL_ERROR "Headless mode is required for tests.") endif() +# Set this to override aspell's dictionaries directory +if(ASPELL_DICT_DIR) + add_definitions(-DASPELL_DICT_DIR="${ASPELL_DICT_DIR}") +endif() + +# Set this to override the myspell dictionaries directory when using enchant +if(ENCHANT_MYSPELL_DICT_DIR) + add_definitions(-DENCHANT_MYSPELL_DICT_DIR="${ENCHANT_MYSPELL_DICT_DIR}") +endif() + # option WEECHAT_HOME set(WEECHAT_HOME "${WEECHAT_HOME}" CACHE STRING "Force a single WeeChat home directory for config, logs, scripts, etc." diff --git a/src/plugins/spell/spell-command.c b/src/plugins/spell/spell-command.c index 82fd51184..35da2df22 100644 --- a/src/plugins/spell/spell-command.c +++ b/src/plugins/spell/spell-command.c @@ -157,6 +157,9 @@ spell_command_speller_list_dicts (void) NULL); #else config = new_aspell_config (); +#ifdef ASPELL_DICT_DIR + aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR); +#endif list = get_aspell_dict_info_list (config); elements = aspell_dict_info_list_elements (list); diff --git a/src/plugins/spell/spell-completion.c b/src/plugins/spell/spell-completion.c index 9ea6b4e7d..c7d9d5448 100644 --- a/src/plugins/spell/spell-completion.c +++ b/src/plugins/spell/spell-completion.c @@ -107,6 +107,9 @@ spell_completion_dicts_cb (const void *pointer, void *data, completion); #else config = new_aspell_config (); +#ifdef ASPELL_DICT_DIR + aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR); +#endif list = get_aspell_dict_info_list (config); elements = aspell_dict_info_list_elements (list); diff --git a/src/plugins/spell/spell-speller.c b/src/plugins/spell/spell-speller.c index 5953f60ac..7e8b3c803 100644 --- a/src/plugins/spell/spell-speller.c +++ b/src/plugins/spell/spell-speller.c @@ -65,6 +65,9 @@ spell_speller_dict_supported (const char *lang) rc = 0; config = new_aspell_config (); +#ifdef ASPELL_DICT_DIR + aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR); +#endif list = get_aspell_dict_info_list (config); elements = aspell_dict_info_list_elements (list); @@ -174,6 +177,9 @@ spell_speller_new (const char *lang) /* create a speller instance for the newly created cell */ config = new_aspell_config (); aspell_config_replace (config, "lang", lang); +#ifdef ASPELL_DICT_DIR + aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR); +#endif #endif /* USE_ENCHANT */ /* apply all options */ diff --git a/src/plugins/spell/spell.c b/src/plugins/spell/spell.c index c506eb8bf..10a7e0c26 100644 --- a/src/plugins/spell/spell.c +++ b/src/plugins/spell/spell.c @@ -1180,6 +1180,9 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) broker = enchant_broker_init (); if (!broker) return WEECHAT_RC_ERROR; +#ifdef ENCHANT_MYSPELL_DICT_DIR + enchant_broker_set_param(broker, "enchant.myspell.dictionary.path", ENCHANT_MYSPELL_DICT_DIR); +#endif #endif /* USE_ENCHANT */ if (!spell_speller_init ())