aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Martin Domingo2015-03-03 13:12:38 +0100
committerAgustin Martin Domingo2015-03-03 13:12:38 +0100
commitc4ade119ccd1904795b2e8d76cd93aedc86d1b09 (patch)
tree7b6907beee19e404f6e049e920b95f7a36559176
parente28ec9a43039dd28dc01cff7f4fe87a84610029a (diff)
downloademacs-c4ade119ccd1904795b2e8d76cd93aedc86d1b09.tar.gz
emacs-c4ade119ccd1904795b2e8d76cd93aedc86d1b09.zip
textmodes/ispell.el: Look for aspell .dat files also under dict-dir, as aspell does.
Originally reported as http://bugs.debian.org/765349. Noticed when aspell has different data-dir and dict-dir. * textmodes/ispell.el (ispell-aspell-find-dictionary): Make sure .dat files for aspell dicts are also searched for in location described by `ispell-aspell-dict-dir', matching aspell's dict-dir variable.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/textmodes/ispell.el42
2 files changed, 32 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 027664c229b..11c0271a564 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
12015-03-03 Agustín Martín Domingo <agustin6martin@gmail.com> 12015-03-03 Agustín Martín Domingo <agustin6martin@gmail.com>
2 2
3 * textmodes/ispell.el (ispell-aspell-find-dictionary): Make sure
4 .dat files for aspell dicts are also searched for in location
5 described by `ispell-aspell-dict-dir', matching aspell's dict-dir
6 variable.
7
82015-03-03 Agustín Martín Domingo <agustin6martin@gmail.com>
9
3 * textmodes/ispell.el (ispell-dicts-name2locale-equivs-alist) 10 * textmodes/ispell.el (ispell-dicts-name2locale-equivs-alist)
4 (ispell-hunspell-fill-dictionary-entry) 11 (ispell-hunspell-fill-dictionary-entry)
5 (ispell-find-hunspell-dictionaries) 12 (ispell-find-hunspell-dictionaries)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index d8fca822f71..a981b523931 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1058,27 +1058,35 @@ Assumes that value contains no whitespace."
1058 "For aspell dictionary DICT-NAME, return a list of parameters if an 1058 "For aspell dictionary DICT-NAME, return a list of parameters if an
1059associated data file is found or nil otherwise. List format is that 1059associated data file is found or nil otherwise. List format is that
1060of `ispell-dictionary-base-alist' elements." 1060of `ispell-dictionary-base-alist' elements."
1061
1062 ;; Make sure `ispell-aspell-dict-dir' is defined
1063 (or ispell-aspell-dict-dir
1064 (setq ispell-aspell-dict-dir
1065 (ispell-get-aspell-config-value "dict-dir")))
1066
1061 ;; Make sure `ispell-aspell-data-dir' is defined 1067 ;; Make sure `ispell-aspell-data-dir' is defined
1062 (or ispell-aspell-data-dir 1068 (or ispell-aspell-data-dir
1063 (setq ispell-aspell-data-dir 1069 (setq ispell-aspell-data-dir
1064 (ispell-get-aspell-config-value "data-dir"))) 1070 (ispell-get-aspell-config-value "data-dir")))
1065 ;; Try finding associated datafile 1071
1066 (let* ((datafile1 1072 ;; Try finding associated datafile. aspell will look for master .dat
1067 (concat ispell-aspell-data-dir "/" 1073 ;; file in `dict-dir' and `data-dir'. Associated .dat files must be
1068 ;; Strip out variant, country code, etc. 1074 ;; in the same directory as master file.
1069 (and (string-match "^[[:alpha:]]+" dict-name) 1075 (let ((data-file
1070 (match-string 0 dict-name)) ".dat")) 1076 (catch 'datafile
1071 (datafile2 1077 (dolist ( tmp-path (list ispell-aspell-dict-dir
1072 (concat ispell-aspell-data-dir "/" 1078 ispell-aspell-data-dir ))
1073 ;; Strip out anything but xx_YY. 1079 ;; Try xx.dat first, strip out variant, country code, etc,
1074 (and (string-match "^[[:alpha:]_]+" dict-name) 1080 ;; then try xx_YY.dat (without stripping country code).
1075 (match-string 0 dict-name)) ".dat")) 1081 (dolist (tmp-regexp (list "^[[:alpha:]]+"
1076 (data-file 1082 "^[[:alpha:]_]+"))
1077 (if (file-readable-p datafile1) 1083 (let ((fullpath
1078 datafile1 1084 (concat tmp-path "/"
1079 (if (file-readable-p datafile2) 1085 (and (string-match tmp-regexp dict-name)
1080 datafile2))) 1086 (match-string 0 dict-name)) ".dat")))
1081 otherchars) 1087 (if (file-readable-p fullpath)
1088 (throw 'datafile fullpath)))))))
1089 otherchars)
1082 1090
1083 (if data-file 1091 (if data-file
1084 (with-temp-buffer 1092 (with-temp-buffer