diff options
| author | Lars Ingebrigtsen | 2022-02-21 17:01:13 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-02-21 17:01:13 +0100 |
| commit | 1f6b5ea54a5be8a18b6487a4776cef7fd9df9d1e (patch) | |
| tree | 7b6dd3d2236b91e49056dcb6f7eb1737b5723ca9 /lisp/textmodes | |
| parent | 69c3ae29692e031296ef0ef4f56808dba4c6c27d (diff) | |
| download | emacs-1f6b5ea54a5be8a18b6487a4776cef7fd9df9d1e.tar.gz emacs-1f6b5ea54a5be8a18b6487a4776cef7fd9df9d1e.zip | |
Make 'ispell-change-dictionary' completion work better
* lisp/textmodes/ispell.el (ispell--aspell-found-dictionaries):
New variable (bug#24050).
(ispell-find-aspell-dictionaries): Save the list of actually
identified dictionary.
(ispell-valid-dictionary-list): Use it to filter out non-installed
dictionaries.
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/ispell.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 6382b402c06..b58514972a1 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -797,6 +797,9 @@ See `ispell-buffer-with-debug' for an example of use." | |||
| 797 | "An alist of parsed Aspell dicts and associated parameters. | 797 | "An alist of parsed Aspell dicts and associated parameters. |
| 798 | Internal use.") | 798 | Internal use.") |
| 799 | 799 | ||
| 800 | (defvar ispell--aspell-found-dictionaries nil | ||
| 801 | "An alist of identified aspell dictionaries.") | ||
| 802 | |||
| 800 | (defun ispell-find-aspell-dictionaries () | 803 | (defun ispell-find-aspell-dictionaries () |
| 801 | "Find Aspell's dictionaries, and record in `ispell-aspell-dictionary-alist'." | 804 | "Find Aspell's dictionaries, and record in `ispell-aspell-dictionary-alist'." |
| 802 | (let* ((dictionaries | 805 | (let* ((dictionaries |
| @@ -810,7 +813,8 @@ Internal use.") | |||
| 810 | (mapcar #'ispell-aspell-find-dictionary dictionaries)))) | 813 | (mapcar #'ispell-aspell-find-dictionary dictionaries)))) |
| 811 | ;; Ensure aspell's alias dictionary will override standard | 814 | ;; Ensure aspell's alias dictionary will override standard |
| 812 | ;; definitions. | 815 | ;; definitions. |
| 813 | (setq found (ispell-aspell-add-aliases found)) | 816 | (setq found (ispell-aspell-add-aliases found) |
| 817 | ispell--aspell-found-dictionaries (copy-sequence found)) | ||
| 814 | ;; Merge into FOUND any elements from the standard ispell-dictionary-base-alist | 818 | ;; Merge into FOUND any elements from the standard ispell-dictionary-base-alist |
| 815 | ;; which have no element in FOUND at all. | 819 | ;; which have no element in FOUND at all. |
| 816 | (dolist (dict ispell-dictionary-base-alist) | 820 | (dolist (dict ispell-dictionary-base-alist) |
| @@ -1378,9 +1382,11 @@ The variable `ispell-library-directory' defines their location." | |||
| 1378 | (if (and name | 1382 | (if (and name |
| 1379 | (or | 1383 | (or |
| 1380 | ;; Include all for Aspell (we already know existing dicts) | 1384 | ;; Include all for Aspell (we already know existing dicts) |
| 1381 | ispell-really-aspell | 1385 | (and ispell-really-aspell |
| 1386 | (assoc name ispell--aspell-found-dictionaries)) | ||
| 1382 | ;; Include all if `ispell-library-directory' is nil (Hunspell) | 1387 | ;; Include all if `ispell-library-directory' is nil (Hunspell) |
| 1383 | (not ispell-library-directory) | 1388 | (and (not ispell-really-aspell) |
| 1389 | (not ispell-library-directory)) | ||
| 1384 | ;; If explicit (-d with an absolute path) and existing dict. | 1390 | ;; If explicit (-d with an absolute path) and existing dict. |
| 1385 | (and dict-explt | 1391 | (and dict-explt |
| 1386 | (file-name-absolute-p dict-explt) | 1392 | (file-name-absolute-p dict-explt) |
| @@ -2986,8 +2992,7 @@ By just answering RET you can find out what the current dictionary is." | |||
| 2986 | (interactive | 2992 | (interactive |
| 2987 | (list (completing-read | 2993 | (list (completing-read |
| 2988 | "Use new dictionary (RET for current, SPC to complete): " | 2994 | "Use new dictionary (RET for current, SPC to complete): " |
| 2989 | (and (fboundp 'ispell-valid-dictionary-list) | 2995 | (mapcar #'list (ispell-valid-dictionary-list)) |
| 2990 | (mapcar #'list (ispell-valid-dictionary-list))) | ||
| 2991 | nil t) | 2996 | nil t) |
| 2992 | current-prefix-arg)) | 2997 | current-prefix-arg)) |
| 2993 | (ispell-set-spellchecker-params) ; Initialize variables and dicts alists | 2998 | (ispell-set-spellchecker-params) ; Initialize variables and dicts alists |