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.
This commit is contained in:
parent
15d78a2464
commit
e28ec9a430
2 changed files with 27 additions and 9 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2015-03-03 Agustín Martín Domingo <agustin6martin@gmail.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2015-02-24 Glenn Morris <rgm@gnu.org>
|
2015-02-24 Glenn Morris <rgm@gnu.org>
|
||||||
|
|
||||||
* net/browse-url.el (browse-url-firefox-startup-arguments):
|
* net/browse-url.el (browse-url-firefox-startup-arguments):
|
||||||
|
|
|
@ -775,7 +775,7 @@ here just for backwards compatibility.")
|
||||||
(make-obsolete-variable 'ispell-aspell-supports-utf8
|
(make-obsolete-variable 'ispell-aspell-supports-utf8
|
||||||
'ispell-encoding8-command "23.1")
|
'ispell-encoding8-command "23.1")
|
||||||
|
|
||||||
(defvar ispell-hunspell-dictionary-equivs-alist
|
(defvar ispell-dicts-name2locale-equivs-alist
|
||||||
'(("american" "en_US")
|
'(("american" "en_US")
|
||||||
("brasileiro" "pt_BR")
|
("brasileiro" "pt_BR")
|
||||||
("british" "en_GB")
|
("british" "en_GB")
|
||||||
|
@ -807,7 +807,7 @@ here just for backwards compatibility.")
|
||||||
("slovenian" "sl_SI")
|
("slovenian" "sl_SI")
|
||||||
("svenska" "sv_SE")
|
("svenska" "sv_SE")
|
||||||
("hebrew" "he_IL"))
|
("hebrew" "he_IL"))
|
||||||
"Alist with matching hunspell dict names for standard dict names in
|
"Alist with known matching locales for standard dict names in
|
||||||
`ispell-dictionary-base-alist'.")
|
`ispell-dictionary-base-alist'.")
|
||||||
|
|
||||||
(defvar ispell-emacs-alpha-regexp
|
(defvar ispell-emacs-alpha-regexp
|
||||||
|
@ -1130,6 +1130,13 @@ Return the new dictionary alist."
|
||||||
(realdict (assoc realname alist)))
|
(realdict (assoc realname alist)))
|
||||||
(when (and realdict (not already-exists-p))
|
(when (and realdict (not already-exists-p))
|
||||||
(push (cons aliasname (cdr realdict)) alist))))))
|
(push (cons aliasname (cdr realdict)) alist))))))
|
||||||
|
;; Add entries for standard dict-names with found locale-matching entry
|
||||||
|
(dolist (dict-map-entry ispell-dicts-name2locale-equivs-alist)
|
||||||
|
(let ((name (car dict-map-entry))
|
||||||
|
(locale (cadr dict-map-entry)))
|
||||||
|
(unless (assoc name alist) ;; skip if already present
|
||||||
|
(if (assoc locale alist)
|
||||||
|
(push (cons name (cdr (assoc locale alist))) alist)))))
|
||||||
alist))
|
alist))
|
||||||
|
|
||||||
;; Make ispell.el work better with hunspell.
|
;; Make ispell.el work better with hunspell.
|
||||||
|
@ -1153,12 +1160,12 @@ all uninitialized dicts using that affix file."
|
||||||
(if (cadr (assoc dict ispell-dictionary-alist))
|
(if (cadr (assoc dict ispell-dictionary-alist))
|
||||||
(message "ispell-hfde: Non void entry for %s. Skipping.\n" dict)
|
(message "ispell-hfde: Non void entry for %s. Skipping.\n" dict)
|
||||||
(let ((dict-alias
|
(let ((dict-alias
|
||||||
(cadr (assoc dict ispell-hunspell-dictionary-equivs-alist)))
|
(cadr (assoc dict ispell-dicts-name2locale-equivs-alist)))
|
||||||
(use-for-dicts (list dict))
|
(use-for-dicts (list dict))
|
||||||
(dict-args-cdr (cdr (ispell-parse-hunspell-affix-file dict)))
|
(dict-args-cdr (cdr (ispell-parse-hunspell-affix-file dict)))
|
||||||
newlist)
|
newlist)
|
||||||
;; Get a list of uninitialized dicts using the same affix file.
|
;; Get a list of uninitialized dicts using the same affix file.
|
||||||
(dolist (dict-equiv-alist-entry ispell-hunspell-dictionary-equivs-alist)
|
(dolist (dict-equiv-alist-entry ispell-dicts-name2locale-equivs-alist)
|
||||||
(let ((dict-equiv-key (car dict-equiv-alist-entry))
|
(let ((dict-equiv-key (car dict-equiv-alist-entry))
|
||||||
(dict-equiv-value (cadr dict-equiv-alist-entry)))
|
(dict-equiv-value (cadr dict-equiv-alist-entry)))
|
||||||
(if (or (member dict dict-equiv-alist-entry)
|
(if (or (member dict dict-equiv-alist-entry)
|
||||||
|
@ -1223,7 +1230,7 @@ Return a list in `ispell-dictionary-alist' format."
|
||||||
"Look for installed hunspell dictionaries.
|
"Look for installed hunspell dictionaries.
|
||||||
Will initialize `ispell-hunspell-dictionary-alist' and
|
Will initialize `ispell-hunspell-dictionary-alist' and
|
||||||
`ispell-hunspell-dictionary-alist' after values found
|
`ispell-hunspell-dictionary-alist' after values found
|
||||||
and remove `ispell-hunspell-dictionary-equivs-alist'
|
and remove `ispell-dicts-name2locale-equivs-alist'
|
||||||
entries if a specific dict was found."
|
entries if a specific dict was found."
|
||||||
(let ((hunspell-found-dicts
|
(let ((hunspell-found-dicts
|
||||||
(split-string
|
(split-string
|
||||||
|
@ -1262,15 +1269,15 @@ entries if a specific dict was found."
|
||||||
"-- ispell-fhd: Skipping entry: %s\n" dict)))))
|
"-- ispell-fhd: Skipping entry: %s\n" dict)))))
|
||||||
;; Remove entry from aliases alist if explicit dict was found.
|
;; Remove entry from aliases alist if explicit dict was found.
|
||||||
(let (newlist)
|
(let (newlist)
|
||||||
(dolist (dict ispell-hunspell-dictionary-equivs-alist)
|
(dolist (dict ispell-dicts-name2locale-equivs-alist)
|
||||||
(if (assoc (car dict) ispell-hunspell-dict-paths-alist)
|
(if (assoc (car dict) ispell-hunspell-dict-paths-alist)
|
||||||
(ispell-print-if-debug
|
(ispell-print-if-debug
|
||||||
"-- ispell-fhd: Excluding %s alias. Standalone dict found.\n"
|
"-- ispell-fhd: Excluding %s alias. Standalone dict found.\n"
|
||||||
(car dict))
|
(car dict))
|
||||||
(add-to-list 'newlist dict)))
|
(add-to-list 'newlist dict)))
|
||||||
(setq ispell-hunspell-dictionary-equivs-alist newlist))
|
(setq ispell-dicts-name2locale-equivs-alist newlist))
|
||||||
;; Add known hunspell aliases
|
;; Add known hunspell aliases
|
||||||
(dolist (dict-equiv ispell-hunspell-dictionary-equivs-alist)
|
(dolist (dict-equiv ispell-dicts-name2locale-equivs-alist)
|
||||||
(let ((dict-equiv-key (car dict-equiv))
|
(let ((dict-equiv-key (car dict-equiv))
|
||||||
(dict-equiv-value (cadr dict-equiv))
|
(dict-equiv-value (cadr dict-equiv))
|
||||||
(exclude-aliases (list ;; Exclude TeX aliases
|
(exclude-aliases (list ;; Exclude TeX aliases
|
||||||
|
@ -1367,7 +1374,7 @@ aspell is used along with Emacs).")
|
||||||
(let* ((dict-name (nth 0 adict))
|
(let* ((dict-name (nth 0 adict))
|
||||||
(dict-equiv
|
(dict-equiv
|
||||||
(cadr (assoc dict-name
|
(cadr (assoc dict-name
|
||||||
ispell-hunspell-dictionary-equivs-alist)))
|
ispell-dicts-name2locale-equivs-alist)))
|
||||||
(ispell-args (nth 5 adict))
|
(ispell-args (nth 5 adict))
|
||||||
(ispell-args-has-d (member "-d" ispell-args))
|
(ispell-args-has-d (member "-d" ispell-args))
|
||||||
skip-dict)
|
skip-dict)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue