summary refs log tree commit diff
path: root/gnu/packages/patches/aspell-default-dict-dir.patch
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-11-14 22:30:24 +0100
committerLudovic Courtès <ludo@gnu.org>2019-11-14 22:30:24 +0100
commit4554d6b77e0f306a3dc33a8c1f68c9a302967a08 (patch)
tree8ad23db223c418a13db6f9fe70e043ed9134aa5a /gnu/packages/patches/aspell-default-dict-dir.patch
parentbb750fa0212fc565a1ecf8a03ce97820c5743c93 (diff)
downloadguix-4554d6b77e0f306a3dc33a8c1f68c9a302967a08.tar.gz
gnu: aspell: Truly honor $ASPELL_DICT_DIR.
Fixes <https://bugs.gnu.org/29686>.
Reported by Oleg Pykhalov <go.wigust@gmail.com>.

* gnu/packages/aspell.scm (aspell)[arguments]: Remove 'wrap-aspell' phase.
* gnu/packages/patches/aspell-default-dict-dir.patch: Add hunk to expand
the right-hand size of '|' in values like "<$FOO|$BAR/baz>".  Change
DICT_DIR to refer to "$HOME" on the right-hand side.
Diffstat (limited to 'gnu/packages/patches/aspell-default-dict-dir.patch')
-rw-r--r--gnu/packages/patches/aspell-default-dict-dir.patch24
1 files changed, 23 insertions, 1 deletions
diff --git a/gnu/packages/patches/aspell-default-dict-dir.patch b/gnu/packages/patches/aspell-default-dict-dir.patch
index 17a6ff606f..5f759a66d9 100644
--- a/gnu/packages/patches/aspell-default-dict-dir.patch
+++ b/gnu/packages/patches/aspell-default-dict-dir.patch
@@ -8,12 +8,34 @@ However it is necessary for applications that use libaspell since
 
 --- a/common/config.cpp
 +++ b/common/config.cpp
+@@ -651,7 +651,20 @@ namespace acommon {
+ 	  } else { // sep == '|'
+ 	    assert(replace[0] == '$');
+ 	    const char * env = getenv(replace.c_str()+1);
+-	    final_str += env ? env : second;
++	    if (env) {
++	      final_str += env;
++	    } else if (second[0] == '$') {
++	      // Expand the right-hand side of '|', which starts with a
++	      // reference to an environment variable.
++	      auto slash = second.find('/');
++	      String variable = second.substr(1, slash - 1);
++	      const char * env = getenv(variable.c_str());
++	      String value = env ? String(env) : "";
++	      value += second.substr(slash, second.size() - slash);
++	      final_str += value;
++	    } else {
++	      final_str += second;
++	    }
+ 	  }
+ 	  replace = "";
+ 	  in_replace = false;
 @@ -1349,6 +1349,9 @@ namespace acommon {
  #  define REPL     ".aspell.<lang>.prepl"
  #endif
  
 +#undef DICT_DIR
-+#define DICT_DIR "<$ASPELL_DICT_DIR|home-dir/.guix-profile/lib/aspell>"
++#define DICT_DIR "<$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell>"
 +
    static const KeyInfo config_keys[] = {
      // the description should be under 50 chars