Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs

From: Glenn Morris <[email-masked]>
Date: Thu, 17 Jan 2013 13:19:34 -0500

(Please keep the debbugs address cc'd.
Resending your comments so that they are more visible.)

Date: Thu, 17 Jan 2013 14:17:34 +0100
From: Jochen Schmitt <[email-masked]>

I have try to create a suggestion for a general solution for
this issue in the next release of emacs.

I have attached a patch on this mail which introduced a alist to
translate the dictionary names like 'english' in the form which will
be accepted by hunspell.

I have done a first short test to check out, that this is a
working solution.
 
Of course the ispell-hunspell-dictionary-alist need extension because 
I have put only two entries to be able to check out my solution.

Best Regards:

Jochen Schmitt

diff -up emacs-24.2/lisp/textmodes/ispell.el.hunspell emacs-24.2/lisp/textmodes/ispell.el
--- emacs-24.2/lisp/textmodes/ispell.el.hunspell	2013-01-17 13:17:45.389785784 +0100
+++ emacs-24.2/lisp/textmodes/ispell.el	2013-01-17 13:19:43.388797273 +0100
@@ -572,6 +572,13 @@ re-start Emacs."
 		       (coding-system :tag "Coding System")))
   :group 'ispell)
 
+(defvar ispell-hunspell-dictionary-alist
+  '((nil "en_GB")
+    ("english" "en_GB")
+    ("american" "en_US")
+   )
+  "Associating list between apell and hunspell dictionaries names"
+)
 
 (defvar ispell-dictionary-base-alist
   '((nil
@@ -2610,7 +2617,9 @@ Keeps argument list for future ispell in
           (append
            (if (and ispell-current-dictionary      ; Not for default dict (nil)
                     (not (member "-d" orig-args))) ; Only define if not overridden.
-               (list "-d" ispell-current-dictionary))
+               (list "-d" (if ispell-really-hunspell
+			      (cadr (assoc ispell-current-dictionary ispell-hunspell-dictionary-alist))
+			   ispell-current-dictionary)))
            orig-args
            (if ispell-current-personal-dictionary ; Use specified pers dict.
                (list "-p"