diff options
| author | Stefan Kangas | 2019-06-27 20:02:56 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-06-27 21:00:35 +0200 |
| commit | b98b843a5b6df987d3dba3e66fe637570c06cd0d (patch) | |
| tree | 80265c97dca5a9f3e26b8eec069720efa7cb10f4 | |
| parent | f9744d23e5bdc90ebdfaf78db55966e436876b28 (diff) | |
| download | emacs-b98b843a5b6df987d3dba3e66fe637570c06cd0d.tar.gz emacs-b98b843a5b6df987d3dba3e66fe637570c06cd0d.zip | |
Add new ispell-change-dictionary-hook (Bug#1110)
* lisp/textmodes/ispell.el (ispell-change-dictionary-hook): New hook.
(ispell-change-dictionary): Call new hook (bug#1110).
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 9 |
2 files changed, 15 insertions, 2 deletions
| @@ -1630,6 +1630,14 @@ When non-nil, watch whether the bookmark file has changed on disk. | |||
| 1630 | This library generates manual C++ template instantiations. It should | 1630 | This library generates manual C++ template instantiations. It should |
| 1631 | no longer be useful on modern compilers, which do this automatically. | 1631 | no longer be useful on modern compilers, which do this automatically. |
| 1632 | 1632 | ||
| 1633 | ** Ispell | ||
| 1634 | |||
| 1635 | --- | ||
| 1636 | *** New hook 'ispell-change-dictionary-hook'. | ||
| 1637 | This runs after changing the dictionary and could be used to | ||
| 1638 | automatically spellcheck a buffer when changing language without | ||
| 1639 | needing to advice 'ispell-change-dictionary'. | ||
| 1640 | |||
| 1633 | 1641 | ||
| 1634 | * New Modes and Packages in Emacs 27.1 | 1642 | * New Modes and Packages in Emacs 27.1 |
| 1635 | 1643 | ||
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index d488c05418c..9dfa9f3c448 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -2973,6 +2973,9 @@ With CLEAR, buffer session localwords are cleaned." | |||
| 2973 | (message "Ispell process killed") | 2973 | (message "Ispell process killed") |
| 2974 | nil)) | 2974 | nil)) |
| 2975 | 2975 | ||
| 2976 | (defvar ispell-change-dictionary-hook nil | ||
| 2977 | "Hook run after changing dictionary.") | ||
| 2978 | |||
| 2976 | ;; ispell-change-dictionary is set in some people's hooks. Maybe this should | 2979 | ;; ispell-change-dictionary is set in some people's hooks. Maybe this should |
| 2977 | ;; call ispell-init-process rather than wait for a spell checking command? | 2980 | ;; call ispell-init-process rather than wait for a spell checking command? |
| 2978 | 2981 | ||
| @@ -2998,7 +3001,8 @@ By just answering RET you can find out what the current dictionary is." | |||
| 2998 | (ispell-internal-change-dictionary) | 3001 | (ispell-internal-change-dictionary) |
| 2999 | (message "Using %s dictionary" | 3002 | (message "Using %s dictionary" |
| 3000 | (or (and (not arg) ispell-local-dictionary) | 3003 | (or (and (not arg) ispell-local-dictionary) |
| 3001 | ispell-dictionary "default"))) | 3004 | ispell-dictionary "default")) |
| 3005 | (run-hooks 'ispell-change-dictionary-hook)) | ||
| 3002 | ((equal dict (or (and (not arg) ispell-local-dictionary) | 3006 | ((equal dict (or (and (not arg) ispell-local-dictionary) |
| 3003 | ispell-dictionary "default")) | 3007 | ispell-dictionary "default")) |
| 3004 | ;; Specified dictionary is the default already. Could reload | 3008 | ;; Specified dictionary is the default already. Could reload |
| @@ -3020,7 +3024,8 @@ By just answering RET you can find out what the current dictionary is." | |||
| 3020 | (setq ispell-buffer-session-localwords nil) | 3024 | (setq ispell-buffer-session-localwords nil) |
| 3021 | (message "%s Ispell dictionary set to %s" | 3025 | (message "%s Ispell dictionary set to %s" |
| 3022 | (if arg "Global" "Local") | 3026 | (if arg "Global" "Local") |
| 3023 | dict)))) | 3027 | dict) |
| 3028 | (run-hooks 'ispell-change-dictionary-hook)))) | ||
| 3024 | 3029 | ||
| 3025 | (defun ispell-internal-change-dictionary () | 3030 | (defun ispell-internal-change-dictionary () |
| 3026 | "Update the dictionary and the personal dictionary used by Ispell. | 3031 | "Update the dictionary and the personal dictionary used by Ispell. |