diff options
| author | Po Lu | 2023-11-08 11:03:57 +0800 |
|---|---|---|
| committer | Po Lu | 2023-11-08 11:03:57 +0800 |
| commit | 089b7d4e6281f47fae51668ce6947aad24e34b76 (patch) | |
| tree | 62dead789c2b89a32ef55c7f41cb39d14df686ef | |
| parent | 3ab99e977db01939cc42f285d5ce58807cf2e7d0 (diff) | |
| download | emacs-089b7d4e6281f47fae51668ce6947aad24e34b76.tar.gz emacs-089b7d4e6281f47fae51668ce6947aad24e34b76.zip | |
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.
| -rw-r--r-- | lisp/simple.el | 10 |
1 files 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." | |||
| 11205 | ;; whether or not auto-fill has actually taken | 11205 | ;; whether or not auto-fill has actually taken |
| 11206 | ;; place. | 11206 | ;; place. |
| 11207 | (old-undo-list buffer-undo-list) | 11207 | (old-undo-list buffer-undo-list) |
| 11208 | ;; Save the point position to return it there | ||
| 11209 | ;; later. | ||
| 11208 | (old-point (point))) | 11210 | (old-point (point))) |
| 11209 | (save-excursion | 11211 | (save-excursion |
| 11210 | (if (and auto-fill-function newline-p) | 11212 | (if (and auto-fill-function newline-p) |
| 11211 | (progn (goto-char (nth 2 edit)) | 11213 | (progn (goto-char (nth 2 edit)) |
| 11212 | (previous-logical-line) | 11214 | (previous-logical-line) |
| 11213 | (funcall auto-fill-function)) | 11215 | (funcall auto-fill-function) |
| 11216 | (setq old-point (point))) | ||
| 11214 | (when (and auto-fill-function auto-fill-p) | 11217 | (when (and auto-fill-function auto-fill-p) |
| 11215 | (progn (goto-char (nth 2 edit)) | 11218 | (goto-char (nth 2 edit)) |
| 11216 | (funcall auto-fill-function)))) | 11219 | (funcall auto-fill-function) |
| 11220 | (setq old-point (point)))) | ||
| 11217 | ;; Record whether or not this edit should result in | 11221 | ;; Record whether or not this edit should result in |
| 11218 | ;; an undo boundary being added. | 11222 | ;; an undo boundary being added. |
| 11219 | (setq any-nonephemeral | 11223 | (setq any-nonephemeral |