summaryrefslogtreecommitdiff
path: root/lisp/textmodes/ispell.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-05-28 02:09:10 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-05-28 02:09:10 +0200
commit390044f854fa103020ffca00eb1fe0e16805ad72 (patch)
tree3a9e25a6ea0519ba3368c54878d6199180b44055 /lisp/textmodes/ispell.el
parent651394d8457247752c9b21ce5cf16414eb7a0d2b (diff)
downloademacs-390044f854fa103020ffca00eb1fe0e16805ad72.tar.gz
Continue checking the same line when hitting SPC in ispell
* lisp/textmodes/ispell.el (ispell-process-line): Continue checking the same line when hitting SPC (bug#20543).
Diffstat (limited to 'lisp/textmodes/ispell.el')
-rw-r--r--lisp/textmodes/ispell.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 4dbc7640bcf..574cf38e56a 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -3431,7 +3431,7 @@ Returns the sum SHIFT due to changes in word replacements."
(word-len (length (car poss)))
(line-end (copy-marker ispell-end))
(line-start (copy-marker ispell-start))
- recheck-region replace)
+ accepted recheck-region replace)
(goto-char word-start)
;; Adjust the horizontal scroll & point
(ispell-horiz-scroll)
@@ -3486,13 +3486,18 @@ Returns the sum SHIFT due to changes in word replacements."
;; Insert correction if needed.
(cond
- ((or (null replace)
- (equal 0 replace)) ; ACCEPT/INSERT
+ ((equal 0 replace) ; INSERT
(if (equal 0 replace) ; BUFFER-LOCAL DICT ADD
(ispell-add-per-file-word-list (car poss)))
;; Do not recheck accepted word on this line.
(setq accept-list (cons (car poss) accept-list)))
- (t ; Replacement word selected or entered.
+ (t
+ ;; The user hit SPC, so accept this word, but keep
+ ;; checking the rest of the line.
+ (unless replace
+ (setq accepted t)
+ (setq replace (list (buffer-substring-no-properties
+ (point) (+ word-len (point))))))
(delete-region (point) (+ word-len (point)))
(if (not (listp replace))
(progn
@@ -3511,9 +3516,9 @@ Returns the sum SHIFT due to changes in word replacements."
(query-replace (car poss) (car replace) t)))
(goto-char word-start)
;; Do not recheck if already accepted.
- (if (member replace-word accept-list)
- (setq accept-list (cons replace-word accept-list)
- replace replace-word)
+ (if (or accepted
+ (member replace-word accept-list))
+ (setq replace replace-word)
(let ((region-end (copy-marker ispell-region-end)))
(setq recheck-region ispell-filter
ispell-filter nil ; Save filter.