;;; rect.el --- rectangle functions for GNU Emacs
-;; Copyright (C) 1985, 1999-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1999-2012 Free Software Foundation, Inc.
;; Maintainer: Didier Verna <didier@xemacs.org>
;; Keywords: internal
"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))
(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)
(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)