[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master b98b843 2/5: Add new ispell-change-dictionary-hook
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master b98b843 2/5: Add new ispell-change-dictionary-hook (Bug#1110) |
Date: |
Thu, 27 Jun 2019 15:00:46 -0400 (EDT) |
branch: master
commit b98b843a5b6df987d3dba3e66fe637570c06cd0d
Author: Stefan Kangas <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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).
---
etc/NEWS | 8 ++++++++
lisp/textmodes/ispell.el | 9 +++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 988ee8b..29ca3e3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1630,6 +1630,14 @@ When non-nil, watch whether the bookmark file has
changed on disk.
This library generates manual C++ template instantiations. It should
no longer be useful on modern compilers, which do this automatically.
+** Ispell
+
+---
+*** New hook 'ispell-change-dictionary-hook'.
+This runs after changing the dictionary and could be used to
+automatically spellcheck a buffer when changing language without
+needing to advice 'ispell-change-dictionary'.
+
* New Modes and Packages in Emacs 27.1
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index d488c05..9dfa9f3 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2973,6 +2973,9 @@ With CLEAR, buffer session localwords are cleaned."
(message "Ispell process killed")
nil))
+(defvar ispell-change-dictionary-hook nil
+ "Hook run after changing dictionary.")
+
;; ispell-change-dictionary is set in some people's hooks. Maybe this should
;; call ispell-init-process rather than wait for a spell checking command?
@@ -2998,7 +3001,8 @@ By just answering RET you can find out what the current
dictionary is."
(ispell-internal-change-dictionary)
(message "Using %s dictionary"
(or (and (not arg) ispell-local-dictionary)
- ispell-dictionary "default")))
+ ispell-dictionary "default"))
+ (run-hooks 'ispell-change-dictionary-hook))
((equal dict (or (and (not arg) ispell-local-dictionary)
ispell-dictionary "default"))
;; 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."
(setq ispell-buffer-session-localwords nil)
(message "%s Ispell dictionary set to %s"
(if arg "Global" "Local")
- dict))))
+ dict)
+ (run-hooks 'ispell-change-dictionary-hook))))
(defun ispell-internal-change-dictionary ()
"Update the dictionary and the personal dictionary used by Ispell.