emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 089b7d4e628: Don't leave point amid text conversion edits if auto


From: Po Lu
Subject: master 089b7d4e628: Don't leave point amid text conversion edits if auto-fill transpires
Date: Tue, 7 Nov 2023 22:04:13 -0500 (EST)

branch: master
commit 089b7d4e6281f47fae51668ce6947aad24e34b76
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Don't leave point amid text conversion edits if auto-fill transpires
    
    * lisp/simple.el (analyze-text-conversion): Save point in
    old-point after auto-fill completes, so that point-moved is not
    set if point remains intact subsequent to the execution of both
    hooks.
---
 lisp/simple.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 3a5a81e0011..266a66500cb 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -11205,15 +11205,19 @@ seconds."
                      ;; whether or not auto-fill has actually taken
                      ;; place.
                      (old-undo-list buffer-undo-list)
+                     ;; Save the point position to return it there
+                     ;; later.
                      (old-point (point)))
                 (save-excursion
                   (if (and auto-fill-function newline-p)
                       (progn (goto-char (nth 2 edit))
                              (previous-logical-line)
-                             (funcall auto-fill-function))
+                             (funcall auto-fill-function)
+                             (setq old-point (point)))
                     (when (and auto-fill-function auto-fill-p)
-                      (progn (goto-char (nth 2 edit))
-                             (funcall auto-fill-function))))
+                      (goto-char (nth 2 edit))
+                      (funcall auto-fill-function)
+                      (setq old-point (point))))
                   ;; Record whether or not this edit should result in
                   ;; an undo boundary being added.
                   (setq any-nonephemeral



reply via email to

[Prev in Thread] Current Thread [Next in Thread]