aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-11 21:12:43 -0500
committerCraig Jennings <c@cjennings.net>2026-07-11 21:12:43 -0500
commitb25c12ecd0e8bf8b3f56f6741181eb7e1d82ac7e (patch)
tree8d0aa0de7f4693e3e30fab3b360e9c2e0d28b2c9 /modules
parent9b906b32b6eccc289aca61b412d828f0daf32f72 (diff)
downloaddotemacs-b25c12ecd0e8bf8b3f56f6741181eb7e1d82ac7e.tar.gz
dotemacs-b25c12ecd0e8bf8b3f56f6741181eb7e1d82ac7e.zip
fix(flyspell-and-abbrev): stop re-scanning the whole buffer on every C-'
cj/flyspell-then-abbrev ran a bare flyspell-buffer guarded by (unless flyspell-mode ...), but nothing turned flyspell-mode on, so the guard never tripped. Every C-' press re-scanned the whole buffer, which is O(buffer) per keypress in large files. I routed the scan through cj/flyspell-on-for-buffer-type instead, so the mode sticks after the first press and the buffer is scanned once.
Diffstat (limited to 'modules')
-rw-r--r--modules/flyspell-and-abbrev.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/flyspell-and-abbrev.el b/modules/flyspell-and-abbrev.el
index b73bfdf3..ebe4898e 100644
--- a/modules/flyspell-and-abbrev.el
+++ b/modules/flyspell-and-abbrev.el
@@ -197,9 +197,10 @@ Without prefix argument, it's created in the global abbrev table.
Press C-' repeatedly to step through misspellings one at a time."
(interactive "P")
(cj/--require-spell-checker)
- ;; Run flyspell-buffer only if buffer hasn't been checked yet
- (unless (bound-and-true-p flyspell-mode)
- (flyspell-buffer))
+ ;; Enable Flyspell for the buffer type so the mode sticks and the buffer is
+ ;; scanned once. A bare flyspell-buffer here never turned the mode on, so
+ ;; the guard never tripped and every C-' press re-scanned the whole buffer.
+ (cj/flyspell-on-for-buffer-type)
(let ((misspelled-word (cj/flyspell-goto-previous-misspelling (point))))
(if (not misspelled-word)