Commit | Line | Data |
---|---|---|
6d35b1c9 LC |
1 | This patch changes the default value of 'dict-dir' to correspond |
2 | to ~/.guix-profile/lib/aspell rather than $prefix/lib/aspell-X.Y. | |
3 | ||
4 | This is not strictly necessary for the 'aspell' program itself since | |
5 | one can simply set "ASPELL_CONF=dict-dir $HOME/.guix-profile/lib/aspell". | |
6 | However it is necessary for applications that use libaspell since | |
7 | 'ASPELL_CONF' is not honored in this case. See <https://bugs.gnu.org/25836>. | |
8 | ||
9 | --- a/common/config.cpp | |
10 | +++ b/common/config.cpp | |
4554d6b7 LC |
11 | @@ -651,7 +651,20 @@ namespace acommon { |
12 | } else { // sep == '|' | |
13 | assert(replace[0] == '$'); | |
14 | const char * env = getenv(replace.c_str()+1); | |
15 | - final_str += env ? env : second; | |
16 | + if (env) { | |
17 | + final_str += env; | |
18 | + } else if (second[0] == '$') { | |
19 | + // Expand the right-hand side of '|', which starts with a | |
20 | + // reference to an environment variable. | |
21 | + auto slash = second.find('/'); | |
22 | + String variable = second.substr(1, slash - 1); | |
23 | + const char * env = getenv(variable.c_str()); | |
24 | + String value = env ? String(env) : ""; | |
25 | + value += second.substr(slash, second.size() - slash); | |
26 | + final_str += value; | |
27 | + } else { | |
28 | + final_str += second; | |
29 | + } | |
30 | } | |
31 | replace = ""; | |
32 | in_replace = false; | |
6d35b1c9 LC |
33 | @@ -1349,6 +1349,9 @@ namespace acommon { |
34 | # define REPL ".aspell.<lang>.prepl" | |
35 | #endif | |
36 | ||
37 | +#undef DICT_DIR | |
4554d6b7 | 38 | +#define DICT_DIR "<$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell>" |
6d35b1c9 LC |
39 | + |
40 | static const KeyInfo config_keys[] = { | |
41 | // the description should be under 50 chars | |
42 | {"actual-dict-dir", KeyInfoString, "<dict-dir^master>", 0} |