emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 501d079: Support in ispell.el multiple dictionaries


From: Eli Zaretskii
Subject: [Emacs-diffs] master 501d079: Support in ispell.el multiple dictionaries loaded by Hunspell
Date: Sat, 25 Mar 2017 12:13:08 -0400 (EDT)

branch: master
commit 501d07981ed1840ae72fe7dd599ab0b9f85b4a7f
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Support in ispell.el multiple dictionaries loaded by Hunspell
    
    * lisp/textmodes/ispell.el (ispell-find-hunspell-dictionaries):
    Support Hunspell configurations that load more than one dictionary
    by default.  Doc fix.  (Bug#25830)
---
 lisp/textmodes/ispell.el | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 9747bd6..db733fe 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1094,10 +1094,10 @@ in the list must have an affix file where Hunspell 
affix files are kept."
 
 (defun ispell-find-hunspell-dictionaries ()
   "Look for installed Hunspell dictionaries.
-Will initialize `ispell-hunspell-dictionary-alist' and
-`ispell-hunspell-dictionary-alist' after values found
-and remove `ispell-dicts-name2locale-equivs-alist'
-entries if a specific dictionary was found."
+Will initialize `ispell-hunspell-dictionary-alist' according
+to dictionaries found, and will remove aliases from the list
+in `ispell-dicts-name2locale-equivs-alist' if an explicit
+dictionary from that list was found."
   (let ((hunspell-found-dicts
         (split-string
          (with-temp-buffer
@@ -1110,18 +1110,27 @@ entries if a specific dictionary was found."
          "[\n\r]+"
          t))
        hunspell-default-dict
-       hunspell-default-dict-entry)
+       hunspell-default-dict-entry
+       hunspell-multi-dict)
     (dolist (dict hunspell-found-dicts)
       (let* ((full-name (file-name-nondirectory dict))
             (basename  (file-name-sans-extension full-name))
             (affix-file (concat dict ".aff")))
        (if (string-match "\\.aff$" dict)
            ;; Found default dictionary
-           (if hunspell-default-dict
-               (error "ispell-fhd: Default dict already defined as %s.  Not 
using %s.\n"
-                      hunspell-default-dict dict)
-             (setq affix-file dict)
-             (setq hunspell-default-dict (list basename affix-file)))
+           (progn
+             (if hunspell-default-dict
+                 (setq hunspell-multi-dict
+                       (concat (or hunspell-multi-dict
+                                   (car hunspell-default-dict))
+                               "," basename))
+               (setq affix-file dict)
+               ;; FIXME: The cdr of the list we cons below is never
+               ;; used.  Why do we need a list?
+               (setq hunspell-default-dict (list basename affix-file)))
+             (ispell-print-if-debug
+              "++ ispell-fhd: default dict-entry:%s name:%s basename:%s\n"
+              dict full-name basename))
          (if (and (not (assoc basename ispell-hunspell-dict-paths-alist))
                   (file-exists-p affix-file))
              ;; Entry has an associated .aff file and no previous value.
@@ -1161,7 +1170,8 @@ entries if a specific dictionary was found."
              (cl-pushnew (list dict-equiv-key affix-file)
                           ispell-hunspell-dict-paths-alist :test #'equal)))))
     ;; Parse and set values for default dictionary.
-    (setq hunspell-default-dict (car hunspell-default-dict))
+    (setq hunspell-default-dict (or hunspell-multi-dict
+                                   (car hunspell-default-dict)))
     (setq hunspell-default-dict-entry
          (ispell-parse-hunspell-affix-file hunspell-default-dict))
     ;; Create an alist of found dicts with only names, except for default dict.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]