diff options
| author | Eli Zaretskii | 2018-05-06 21:20:31 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-06-02 12:35:42 +0300 |
| commit | 35c1ab1419174f72010c745d963a55b6c183443c (patch) | |
| tree | ef34c1f128009ff1c03b645b338e2ebb3dba258c | |
| parent | aac541e75e2c22d05752025c2087ae2eea4cb525 (diff) | |
| download | emacs-35c1ab1419174f72010c745d963a55b6c183443c.tar.gz emacs-35c1ab1419174f72010c745d963a55b6c183443c.zip | |
Don't remove highlight of misspelled word on pdict save
* lisp/textmodes/ispell.el (ispell-pdict-save): Don't restart
flyspell-mode, as bug#11963, which this was supposed to fix, is
fixed better by ispell-command-loop, when the user types 'i' or
'a'. Restarting Flyspell mode when the personal dictionary is
saved caused bug#31372 as side effect.
(ispell-command-loop): Test 'flyspell-mode', not whether
flyspell-unhighlight-at is fboundp, to determine whether Flyspell
mode is turned on in the current buffer.
(flyspell-unhighlight-at): Add declare-function form for it.
(cherry picked from commit 91e582a31ada28fab5ae55bdbf959a9d30796587)
| -rw-r--r-- | lisp/textmodes/ispell.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 3674a7080be..2b88057dc4f 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -117,6 +117,8 @@ | |||
| 117 | 117 | ||
| 118 | (defalias 'check-ispell-version 'ispell-check-version) | 118 | (defalias 'check-ispell-version 'ispell-check-version) |
| 119 | 119 | ||
| 120 | (declare-function flyspell-unhighlight-at "flyspell" (pos)) | ||
| 121 | |||
| 120 | ;;; ********************************************************************** | 122 | ;;; ********************************************************************** |
| 121 | ;;; The following variables should be set according to personal preference | 123 | ;;; The following variables should be set according to personal preference |
| 122 | ;;; and location of binaries: | 124 | ;;; and location of binaries: |
| @@ -2090,10 +2092,7 @@ If so, ask if it needs to be saved." | |||
| 2090 | (or no-query | 2092 | (or no-query |
| 2091 | (y-or-n-p "Personal dictionary modified. Save? "))) | 2093 | (y-or-n-p "Personal dictionary modified. Save? "))) |
| 2092 | (ispell-send-string "#\n") ; save dictionary | 2094 | (ispell-send-string "#\n") ; save dictionary |
| 2093 | (message "Personal dictionary saved.") | 2095 | (message "Personal dictionary saved.")) |
| 2094 | (when flyspell-mode | ||
| 2095 | (flyspell-mode 0) | ||
| 2096 | (flyspell-mode 1))) | ||
| 2097 | ;; unassert variable, even if not saved to avoid questioning. | 2096 | ;; unassert variable, even if not saved to avoid questioning. |
| 2098 | (setq ispell-pdict-modified-p nil)) | 2097 | (setq ispell-pdict-modified-p nil)) |
| 2099 | 2098 | ||
| @@ -2221,15 +2220,16 @@ Global `ispell-quit' set to start location to continue spell session." | |||
| 2221 | ((= char ?i) ; accept and insert word into pers dict | 2220 | ((= char ?i) ; accept and insert word into pers dict |
| 2222 | (ispell-send-string (concat "*" word "\n")) | 2221 | (ispell-send-string (concat "*" word "\n")) |
| 2223 | (setq ispell-pdict-modified-p '(t)) ; dictionary modified! | 2222 | (setq ispell-pdict-modified-p '(t)) ; dictionary modified! |
| 2224 | (when (fboundp 'flyspell-unhighlight-at) | 2223 | |
| 2225 | (flyspell-unhighlight-at start)) | 2224 | (when flyspell-mode |
| 2225 | (flyspell-unhighlight-at start)) | ||
| 2226 | nil) | 2226 | nil) |
| 2227 | ((or (= char ?a) (= char ?A)) ; accept word without insert | 2227 | ((or (= char ?a) (= char ?A)) ; accept word without insert |
| 2228 | (ispell-send-string (concat "@" word "\n")) | 2228 | (ispell-send-string (concat "@" word "\n")) |
| 2229 | (cl-pushnew word ispell-buffer-session-localwords | 2229 | (cl-pushnew word ispell-buffer-session-localwords |
| 2230 | :test #'equal) | 2230 | :test #'equal) |
| 2231 | (when (fboundp 'flyspell-unhighlight-at) | 2231 | (when flyspell-mode |
| 2232 | (flyspell-unhighlight-at start)) | 2232 | (flyspell-unhighlight-at start)) |
| 2233 | (or ispell-buffer-local-name ; session localwords might conflict | 2233 | (or ispell-buffer-local-name ; session localwords might conflict |
| 2234 | (setq ispell-buffer-local-name (buffer-name))) | 2234 | (setq ispell-buffer-local-name (buffer-name))) |
| 2235 | (if (null ispell-pdict-modified-p) | 2235 | (if (null ispell-pdict-modified-p) |