aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Martin Domingo2015-02-24 19:36:30 +0100
committerAgustin Martin Domingo2015-03-03 12:48:58 +0100
commite28ec9a43039dd28dc01cff7f4fe87a84610029a (patch)
tree930a0c7325e3228bf5184b2717064a1d3746f6d9
parent15d78a2464a284ee29013dcce9431d446f962179 (diff)
downloademacs-e28ec9a43039dd28dc01cff7f4fe87a84610029a.tar.gz
emacs-e28ec9a43039dd28dc01cff7f4fe87a84610029a.zip
ispell.el: Extend to aspell current hunspell handling of aliases names for standard dicts.
Extend `ispell-hunspell-dictionary-equivs-alist' use to aspell, once renamed to a more general `ispell-dicts-name2locale-equivs-alist' name. Originally reported as http://bugs.debian.org/745613 * textmodes/ispell.el (ispell-dicts-name2locale-equivs-alist) (ispell-hunspell-fill-dictionary-entry) (ispell-find-hunspell-dictionaries) (ispell-set-spellchecker-params): New generic name for `ispell-hunspell-dictionary-equivs-alist'. (ispell-aspell-add-aliases): Also use `ispell-dicts-name2locale-equivs-alist' to get aspell aliases for standard dict names.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/textmodes/ispell.el25
2 files changed, 27 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a5603941ad1..027664c229b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12015-03-03 Agustín Martín Domingo <agustin6martin@gmail.com>
2
3 * textmodes/ispell.el (ispell-dicts-name2locale-equivs-alist)
4 (ispell-hunspell-fill-dictionary-entry)
5 (ispell-find-hunspell-dictionaries)
6 (ispell-set-spellchecker-params): New generic name for
7 `ispell-hunspell-dictionary-equivs-alist'.
8 (ispell-aspell-add-aliases): Also use
9 `ispell-dicts-name2locale-equivs-alist' to get aspell aliases for
10 standard dict names.
11
12015-02-24 Glenn Morris <rgm@gnu.org> 122015-02-24 Glenn Morris <rgm@gnu.org>
2 13
3 * net/browse-url.el (browse-url-firefox-startup-arguments): 14 * net/browse-url.el (browse-url-firefox-startup-arguments):
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 81d8078df40..d8fca822f71 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -775,7 +775,7 @@ here just for backwards compatibility.")
775(make-obsolete-variable 'ispell-aspell-supports-utf8 775(make-obsolete-variable 'ispell-aspell-supports-utf8
776 'ispell-encoding8-command "23.1") 776 'ispell-encoding8-command "23.1")
777 777
778(defvar ispell-hunspell-dictionary-equivs-alist 778(defvar ispell-dicts-name2locale-equivs-alist
779 '(("american" "en_US") 779 '(("american" "en_US")
780 ("brasileiro" "pt_BR") 780 ("brasileiro" "pt_BR")
781 ("british" "en_GB") 781 ("british" "en_GB")
@@ -807,7 +807,7 @@ here just for backwards compatibility.")
807 ("slovenian" "sl_SI") 807 ("slovenian" "sl_SI")
808 ("svenska" "sv_SE") 808 ("svenska" "sv_SE")
809 ("hebrew" "he_IL")) 809 ("hebrew" "he_IL"))
810 "Alist with matching hunspell dict names for standard dict names in 810 "Alist with known matching locales for standard dict names in
811 `ispell-dictionary-base-alist'.") 811 `ispell-dictionary-base-alist'.")
812 812
813(defvar ispell-emacs-alpha-regexp 813(defvar ispell-emacs-alpha-regexp
@@ -1130,6 +1130,13 @@ Return the new dictionary alist."
1130 (realdict (assoc realname alist))) 1130 (realdict (assoc realname alist)))
1131 (when (and realdict (not already-exists-p)) 1131 (when (and realdict (not already-exists-p))
1132 (push (cons aliasname (cdr realdict)) alist)))))) 1132 (push (cons aliasname (cdr realdict)) alist))))))
1133 ;; Add entries for standard dict-names with found locale-matching entry
1134 (dolist (dict-map-entry ispell-dicts-name2locale-equivs-alist)
1135 (let ((name (car dict-map-entry))
1136 (locale (cadr dict-map-entry)))
1137 (unless (assoc name alist) ;; skip if already present
1138 (if (assoc locale alist)
1139 (push (cons name (cdr (assoc locale alist))) alist)))))
1133 alist)) 1140 alist))
1134 1141
1135;; Make ispell.el work better with hunspell. 1142;; Make ispell.el work better with hunspell.
@@ -1153,12 +1160,12 @@ all uninitialized dicts using that affix file."
1153 (if (cadr (assoc dict ispell-dictionary-alist)) 1160 (if (cadr (assoc dict ispell-dictionary-alist))
1154 (message "ispell-hfde: Non void entry for %s. Skipping.\n" dict) 1161 (message "ispell-hfde: Non void entry for %s. Skipping.\n" dict)
1155 (let ((dict-alias 1162 (let ((dict-alias
1156 (cadr (assoc dict ispell-hunspell-dictionary-equivs-alist))) 1163 (cadr (assoc dict ispell-dicts-name2locale-equivs-alist)))
1157 (use-for-dicts (list dict)) 1164 (use-for-dicts (list dict))
1158 (dict-args-cdr (cdr (ispell-parse-hunspell-affix-file dict))) 1165 (dict-args-cdr (cdr (ispell-parse-hunspell-affix-file dict)))
1159 newlist) 1166 newlist)
1160 ;; Get a list of uninitialized dicts using the same affix file. 1167 ;; Get a list of uninitialized dicts using the same affix file.
1161 (dolist (dict-equiv-alist-entry ispell-hunspell-dictionary-equivs-alist) 1168 (dolist (dict-equiv-alist-entry ispell-dicts-name2locale-equivs-alist)
1162 (let ((dict-equiv-key (car dict-equiv-alist-entry)) 1169 (let ((dict-equiv-key (car dict-equiv-alist-entry))
1163 (dict-equiv-value (cadr dict-equiv-alist-entry))) 1170 (dict-equiv-value (cadr dict-equiv-alist-entry)))
1164 (if (or (member dict dict-equiv-alist-entry) 1171 (if (or (member dict dict-equiv-alist-entry)
@@ -1223,7 +1230,7 @@ Return a list in `ispell-dictionary-alist' format."
1223 "Look for installed hunspell dictionaries. 1230 "Look for installed hunspell dictionaries.
1224Will initialize `ispell-hunspell-dictionary-alist' and 1231Will initialize `ispell-hunspell-dictionary-alist' and
1225`ispell-hunspell-dictionary-alist' after values found 1232`ispell-hunspell-dictionary-alist' after values found
1226and remove `ispell-hunspell-dictionary-equivs-alist' 1233and remove `ispell-dicts-name2locale-equivs-alist'
1227entries if a specific dict was found." 1234entries if a specific dict was found."
1228 (let ((hunspell-found-dicts 1235 (let ((hunspell-found-dicts
1229 (split-string 1236 (split-string
@@ -1262,15 +1269,15 @@ entries if a specific dict was found."
1262 "-- ispell-fhd: Skipping entry: %s\n" dict))))) 1269 "-- ispell-fhd: Skipping entry: %s\n" dict)))))
1263 ;; Remove entry from aliases alist if explicit dict was found. 1270 ;; Remove entry from aliases alist if explicit dict was found.
1264 (let (newlist) 1271 (let (newlist)
1265 (dolist (dict ispell-hunspell-dictionary-equivs-alist) 1272 (dolist (dict ispell-dicts-name2locale-equivs-alist)
1266 (if (assoc (car dict) ispell-hunspell-dict-paths-alist) 1273 (if (assoc (car dict) ispell-hunspell-dict-paths-alist)
1267 (ispell-print-if-debug 1274 (ispell-print-if-debug
1268 "-- ispell-fhd: Excluding %s alias. Standalone dict found.\n" 1275 "-- ispell-fhd: Excluding %s alias. Standalone dict found.\n"
1269 (car dict)) 1276 (car dict))
1270 (add-to-list 'newlist dict))) 1277 (add-to-list 'newlist dict)))
1271 (setq ispell-hunspell-dictionary-equivs-alist newlist)) 1278 (setq ispell-dicts-name2locale-equivs-alist newlist))
1272 ;; Add known hunspell aliases 1279 ;; Add known hunspell aliases
1273 (dolist (dict-equiv ispell-hunspell-dictionary-equivs-alist) 1280 (dolist (dict-equiv ispell-dicts-name2locale-equivs-alist)
1274 (let ((dict-equiv-key (car dict-equiv)) 1281 (let ((dict-equiv-key (car dict-equiv))
1275 (dict-equiv-value (cadr dict-equiv)) 1282 (dict-equiv-value (cadr dict-equiv))
1276 (exclude-aliases (list ;; Exclude TeX aliases 1283 (exclude-aliases (list ;; Exclude TeX aliases
@@ -1367,7 +1374,7 @@ aspell is used along with Emacs).")
1367 (let* ((dict-name (nth 0 adict)) 1374 (let* ((dict-name (nth 0 adict))
1368 (dict-equiv 1375 (dict-equiv
1369 (cadr (assoc dict-name 1376 (cadr (assoc dict-name
1370 ispell-hunspell-dictionary-equivs-alist))) 1377 ispell-dicts-name2locale-equivs-alist)))
1371 (ispell-args (nth 5 adict)) 1378 (ispell-args (nth 5 adict))
1372 (ispell-args-has-d (member "-d" ispell-args)) 1379 (ispell-args-has-d (member "-d" ispell-args))
1373 skip-dict) 1380 skip-dict)