emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/backports-25.2 f24a305 26/46: Make `undo' of `C-x


From: Noam Postavsky
Subject: [Emacs-diffs] scratch/backports-25.2 f24a305 26/46: Make `undo' of `C-x r t' put point where it should be
Date: Sun, 2 Oct 2016 14:04:49 +0000 (UTC)

branch: scratch/backports-25.2
commit f24a30595cb738bca66fa71ec983296d748e8e41
Author: Lars Ingebrigtsen <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Make `undo' of `C-x r t' put point where it should be
    
    * lisp/rect.el (string-rectangle): Make `undo' of a this
    command put point back where it was (bug#7522).
    
    (cherry picked from commit 8c3245ef0107337d0a2284c58089e2e8e21e257c)
---
 lisp/rect.el |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/rect.el b/lisp/rect.el
index 70a542d..13499d6 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -473,10 +473,15 @@ Called from a program, takes three args; START, END and 
STRING."
                              #'rectangle--string-erase-preview nil t)
                    (add-hook 'post-command-hook
                              #'rectangle--string-preview nil t))
-          (read-string (format "String rectangle (default %s): "
-                               (or (car string-rectangle-history) ""))
-                       nil 'string-rectangle-history
+               (read-string (format "String rectangle (default %s): "
+                                    (or (car string-rectangle-history) ""))
+                            nil 'string-rectangle-history
                             (car string-rectangle-history)))))))
+  ;; If we undo this change, we want to have the point back where we
+  ;; are now, and not after the first line in the rectangle (which is
+  ;; the first line to be changed by the following command).
+  (unless (eq buffer-undo-list t)
+    (push (point) buffer-undo-list))
   (goto-char
    (apply-on-rectangle 'string-rectangle-line start end string t)))
 



reply via email to

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