1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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 91e582a31a)
This commit is contained in:
Eli Zaretskii 2018-05-06 21:20:31 +03:00
parent aac541e75e
commit 35c1ab1419

View file

@ -117,6 +117,8 @@
(defalias 'check-ispell-version 'ispell-check-version)
(declare-function flyspell-unhighlight-at "flyspell" (pos))
;;; **********************************************************************
;;; The following variables should be set according to personal preference
;;; and location of binaries:
@ -2090,10 +2092,7 @@ If so, ask if it needs to be saved."
(or no-query
(y-or-n-p "Personal dictionary modified. Save? ")))
(ispell-send-string "#\n") ; save dictionary
(message "Personal dictionary saved.")
(when flyspell-mode
(flyspell-mode 0)
(flyspell-mode 1)))
(message "Personal dictionary saved."))
;; unassert variable, even if not saved to avoid questioning.
(setq ispell-pdict-modified-p nil))
@ -2221,15 +2220,16 @@ Global `ispell-quit' set to start location to continue spell session."
((= char ?i) ; accept and insert word into pers dict
(ispell-send-string (concat "*" word "\n"))
(setq ispell-pdict-modified-p '(t)) ; dictionary modified!
(when (fboundp 'flyspell-unhighlight-at)
(flyspell-unhighlight-at start))
(when flyspell-mode
(flyspell-unhighlight-at start))
nil)
((or (= char ?a) (= char ?A)) ; accept word without insert
(ispell-send-string (concat "@" word "\n"))
(cl-pushnew word ispell-buffer-session-localwords
:test #'equal)
(when (fboundp 'flyspell-unhighlight-at)
(flyspell-unhighlight-at start))
(when flyspell-mode
(flyspell-unhighlight-at start))
(or ispell-buffer-local-name ; session localwords might conflict
(setq ispell-buffer-local-name (buffer-name)))
(if (null ispell-pdict-modified-p)