diff options
author | Lars Magne Ingebrigtsen <[email protected]> | 2011-07-14 17:23:08 +0200 |
---|---|---|
committer | Lars Magne Ingebrigtsen <[email protected]> | 2011-07-14 17:23:08 +0200 |
commit | 7509a874332af5ea1ce20a36f7dccd207b5090c3 (patch) | |
tree | 6af229926b3d27a8cf04b3d12e4fae7bec87176d /lisp | |
parent | 9d2dcee629762c5d361200fe943851b1f0313c4a (diff) |
Leave point at the end of the rectangle after replacing text
* rect.el (apply-on-rectangle): Return the point after the last
operation.
(string-rectangle): Go to the point after the last operation
(bug#7522).
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/rect.el | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f04ba40df4..088323ee87 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2011-07-14 Lars Magne Ingebrigtsen <[email protected]> + * rect.el (apply-on-rectangle): Return the point after the last + operation. + (string-rectangle): Go to the point after the last operation + (bug#7522). + * simple.el (current-kill): Clarify what `interprogram-paste-function' does (bug#7500). diff --git a/lisp/rect.el b/lisp/rect.el index ad914cab7d..0756ec3bc0 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -93,8 +93,9 @@ Point is at the end of the segment of this line within the rectangle." "Call FUNCTION for each line of rectangle with corners at START, END. FUNCTION is called with two arguments: the start and end columns of the rectangle, plus ARGS extra arguments. Point is at the beginning of line when -the function is called." - (let (startcol startpt endcol endpt) +the function is called. +The final point after the last operation will be returned." + (let (startcol startpt endcol endpt final-point) (save-excursion (goto-char start) (setq startcol (current-column)) @@ -112,8 +113,9 @@ the function is called." (goto-char startpt) (while (< (point) endpt) (apply function startcol endcol args) + (setq final-point (point)) (forward-line 1))) - )) + final-point)) (defun delete-rectangle-line (startcol endcol fill) (when (= (move-to-column startcol (if fill t 'coerce)) startcol) @@ -323,7 +325,8 @@ Called from a program, takes three args; START, END and STRING." (or (car string-rectangle-history) "")) nil 'string-rectangle-history (car string-rectangle-history))))) - (apply-on-rectangle 'string-rectangle-line start end string t)) + (goto-char + (apply-on-rectangle 'string-rectangle-line start end string t))) ;;;###autoload (defalias 'replace-rectangle 'string-rectangle) |