From 76a47494979a5d169608d2f91eb89233257133e8 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 26 Jul 2006 17:11:07 +0000 Subject: [PATCH] (ispell-word): If we replace the word, move point to the end. Insert before deleting. --- lisp/textmodes/ispell.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index a4d873a543d..a0eb147d9c8 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -1650,9 +1650,15 @@ quit spell session exited." cursor-location)) (if (not (equal new-word (car poss))) (progn - (delete-region start end) - (setq start (point)) + (goto-char start) + ;; Insert first and then delete, + ;; to avoid collapsing markers before and after + ;; into a single place. (ispell-insert-word new-word) + (delete-region (point) (+ (point) (- end start))) + ;; It is meaningless to preserve the cursor position + ;; inside a word that has changed. + (setq cursor-location (point)) (setq end (point)))) (if (not (atom replace)) ;recheck spelling of replacement (progn -- 2.39.2