1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Improve performance of 'flyspell-goto-next-error'

* lisp/textmodes/flyspell.el (flyspell-goto-next-error): Use
'next-overlay-change' and 'previous-overlay-change'.
(Bug#79933)
This commit is contained in:
Kristoffer Balintona 2025-11-26 08:04:22 -06:00 committed by Eli Zaretskii
parent cbf9c58730
commit 21f9295aa9

View file

@ -1748,17 +1748,11 @@ FLYSPELL-BUFFER."
(setq pos (point))) (setq pos (point)))
;; Seek the next error. ;; Seek the next error.
(while (and (/= pos max) (while (and (/= pos max)
(let ((ovs (overlays-at pos)) (setq pos (if previous
(r '())) (previous-overlay-change pos)
(while (and (not r) (consp ovs)) (next-overlay-change pos)))
(if (flyspell-overlay-p (car ovs)) (not (any #'flyspell-overlay-p (overlays-at pos)))))
(setq r t)
(setq ovs (cdr ovs))))
(not r)))
(setq pos (if previous (1- pos) (1+ pos))))
(goto-char pos) (goto-char pos)
(when previous
(forward-word -1))
;; Save the current location for next invocation. ;; Save the current location for next invocation.
(setq flyspell-old-pos-error (point)) (setq flyspell-old-pos-error (point))
(setq flyspell-old-buffer-error (current-buffer)) (setq flyspell-old-buffer-error (current-buffer))