diff options
| author | Lars Ingebrigtsen | 2016-04-28 01:15:16 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-04-28 01:15:16 +0200 |
| commit | 8c3245ef0107337d0a2284c58089e2e8e21e257c (patch) | |
| tree | 4675e6035f67dbe3ab24f6c6393e1984d2692557 | |
| parent | 388bb723fa078158d3148de05e942f9c01e95dd8 (diff) | |
| download | emacs-8c3245ef0107337d0a2284c58089e2e8e21e257c.tar.gz emacs-8c3245ef0107337d0a2284c58089e2e8e21e257c.zip | |
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).
| -rw-r--r-- | lisp/rect.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/rect.el b/lisp/rect.el index 6056b14734d..07e0f6fc14b 100644 --- a/lisp/rect.el +++ b/lisp/rect.el | |||
| @@ -476,10 +476,15 @@ Called from a program, takes three args; START, END and STRING." | |||
| 476 | #'rectangle--string-erase-preview nil t) | 476 | #'rectangle--string-erase-preview nil t) |
| 477 | (add-hook 'post-command-hook | 477 | (add-hook 'post-command-hook |
| 478 | #'rectangle--string-preview nil t)) | 478 | #'rectangle--string-preview nil t)) |
| 479 | (read-string (format "String rectangle (default %s): " | 479 | (read-string (format "String rectangle (default %s): " |
| 480 | (or (car string-rectangle-history) "")) | 480 | (or (car string-rectangle-history) "")) |
| 481 | nil 'string-rectangle-history | 481 | nil 'string-rectangle-history |
| 482 | (car string-rectangle-history))))))) | 482 | (car string-rectangle-history))))))) |
| 483 | ;; If we undo this change, we want to have the point back where we | ||
| 484 | ;; are now, and not after the first line in the rectangle (which is | ||
| 485 | ;; the first line to be changed by the following command). | ||
| 486 | (unless (eq buffer-undo-list t) | ||
| 487 | (push (point) buffer-undo-list)) | ||
| 483 | (goto-char | 488 | (goto-char |
| 484 | (apply-on-rectangle 'string-rectangle-line start end string t))) | 489 | (apply-on-rectangle 'string-rectangle-line start end string t))) |
| 485 | 490 | ||