1db854
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
1db854
index 1daec44..7167dc9 100644
1db854
--- a/lisp/textmodes/ispell.el
1db854
+++ b/lisp/textmodes/ispell.el
1db854
@@ -574,6 +574,40 @@ re-start Emacs."
1db854
 		       (coding-system :tag "Coding System")))
1db854
   :group 'ispell)
1db854
 
1db854
+(defvar ispell-hunspell-dictionary-equivs-alist
1db854
+  '(("american"      "en_US")
1db854
+    ("brasileiro"    "pt_BR")
1db854
+    ("british"       "en_GB")
1db854
+    ("castellano"    "es_ES")
1db854
+    ("castellano8"   "es_ES")
1db854
+    ("czech"         "cs_CZ")
1db854
+    ("dansk"         "da_DK")
1db854
+    ("deutsch"       "de_DE")
1db854
+    ("deutsch8"      "de_DE")
1db854
+    ("english"       "en_US")
1db854
+    ("esperanto"     "eo")
1db854
+    ("esperanto-tex" "eo")
1db854
+    ("finnish"       "fi_FI")
1db854
+    ("francais7"     "fr_FR")
1db854
+    ("francais"      "fr_FR")
1db854
+    ("francais-tex"  "fr_FR")
1db854
+    ("german"        "de_DE")
1db854
+    ("german8"       "de_DE")
1db854
+    ("italiano"      "it_IT")
1db854
+    ("nederlands"    "nl_NL")
1db854
+    ("nederlands8"   "nl_NL")
1db854
+    ("norsk"         "nn_NO")
1db854
+    ("norsk7-tex"    "nn_NO")
1db854
+    ("polish"        "pl_PL")
1db854
+    ("portugues"     "pt_PT")
1db854
+    ("russian"       "ru_RU")
1db854
+    ("russianw"      "ru_RU")
1db854
+    ("slovak"        "sk_SK")
1db854
+    ("slovenian"     "sl_SI")
1db854
+    ("svenska"       "sv_SE")
1db854
+    ("hebrew"        "he_IL"))
1db854
+  "Alist with matching hunspell dict names for standard dict names in
1db854
+  `ispell-dictionary-base-alist'.")
1db854
 
1db854
 (defvar ispell-dictionary-base-alist
1db854
   '((nil                                ; default
1db854
@@ -1112,9 +1146,57 @@ aspell is used along with Emacs).")
1db854
 		    ispell-encoding8-command)
1db854
 	       ispell-aspell-dictionary-alist
1db854
 	     nil))
1db854
+	  (ispell-dictionary-base-alist ispell-dictionary-base-alist)
1db854
 	  ispell-base-dicts-override-alist ; Override only base-dicts-alist
1db854
 	  all-dicts-alist)
1db854
 
1db854
+      ;; While ispell and aspell (through aliases) use the traditional
1db854
+      ;; dict naming originally expected by ispell.el, hunspell
1db854
+      ;; uses locale based names with no alias.  We need to map
1db854
+      ;; standard names to locale based names to make default dict
1db854
+      ;; definitions available for hunspell.
1db854
+      (if ispell-really-hunspell
1db854
+	  (let (tmp-dicts-alist)
1db854
+	    (dolist (adict ispell-dictionary-base-alist)
1db854
+	      (let* ((dict-name (nth 0 adict))
1db854
+		     (dict-equiv
1db854
+		      (cadr (assoc dict-name
1db854
+				   ispell-hunspell-dictionary-equivs-alist)))
1db854
+		     (ispell-args (nth 5 adict))
1db854
+		     (ispell-args-has-d (member "-d" ispell-args))
1db854
+		     skip-dict)
1db854
+		;; Remove "-d" option from `ispell-args' if present
1db854
+		(if ispell-args-has-d
1db854
+		    (let ((ispell-args-after-d
1db854
+			   (cdr (cdr ispell-args-has-d)))
1db854
+			  (ispell-args-before-d
1db854
+			   (butlast ispell-args (length ispell-args-has-d))))
1db854
+		      (setq ispell-args
1db854
+			    (nconc ispell-args-before-d
1db854
+				   ispell-args-after-d))))
1db854
+		;; Unless default dict, re-add "-d" option with the mapped value
1db854
+		(if dict-name
1db854
+		    (if dict-equiv
1db854
+			(nconc ispell-args (list "-d" dict-equiv))
1db854
+		      (message
1db854
+		       "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping."
1db854
+		       dict-name)
1db854
+		      (setq skip-dict t)))
1db854
+
1db854
+		(unless skip-dict
1db854
+		  (add-to-list 'tmp-dicts-alist
1db854
+			       (list
1db854
+				dict-name      ; dict name
1db854
+				(nth 1 adict)  ; casechars
1db854
+				(nth 2 adict)  ; not-casechars
1db854
+				(nth 3 adict)  ; otherchars
1db854
+				(nth 4 adict)  ; many-otherchars-p
1db854
+				ispell-args    ; ispell-args
1db854
+				(nth 6 adict)  ; extended-character-mode
1db854
+				(nth 7 adict)  ; dict encoding
1db854
+				))))
1db854
+	      (setq ispell-dictionary-base-alist tmp-dicts-alist))))
1db854
+
1db854
       (run-hooks 'ispell-initialize-spellchecker-hook)
1db854
 
1db854
       ;; Add dicts to ``ispell-dictionary-alist'' unless already present.