;;; Commentary:
-;; This package provides the operations on rectangles that are ocumented
+;; This package provides the operations on rectangles that are documented
;; in the XEmacs Reference Manual.
;; ### NOTE: this file has been almost completely rewritten by Didier Verna
;; The replacement for `operate-on-rectangle' -- dv
(defun apply-on-rectangle (function start end &rest args)
- "Call FUNCTION for each line of rectangle with corners at START, END.
+ "Call FUNCTION for each line of rectangle with corners at START and 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."
+rectangle, plus ARGS extra arguments. Point is at the beginning of line
+when the function is called."
(let (startcol startpt endcol endpt)
(save-excursion
(goto-char start)
;;;###autoload
(defvar killed-rectangle nil
- "Rectangle for yank-rectangle to insert.")
+ "Rectangle for `yank-rectangle' to insert.")
;;;###autoload
(defun kill-rectangle (start end &optional fill)
- "Delete the rectangle with corners at point and mark (START and END when
-called from a program) and save it as the last killed one. You might prefer to
-use `delete-extract-rectangle' from a program.
+ "Delete the region-rectangle and save it as the last killed one.
+You might prefer to use `delete-extract-rectangle' from a program.
-With a prefix (or a FILL) argument, also fill lines where nothing has to be
+When called from a program, the rectangle's corners are START and END.
+With a prefix (or FILL) argument, also fill lines where nothing has to be
deleted."
- (interactive "r\nP")
+ (interactive "*r\nP")
(when buffer-read-only
(setq killed-rectangle (extract-rectangle start end))
(barf-if-buffer-read-only))
;;;###autoload
(defun delete-rectangle (start end &optional fill)
- "Delete (don't save) text in rectangle with corners at point and mark (START
-and END when called from a program). The same range of columns is deleted in
-each line starting with the line where the region begins and ending with the
-line where the region ends.
+ "Delete the text in the region-rectangle without saving it.
+The same range of columns is deleted in each line starting with the line
+where the region begins and ending with the line where the region ends.
-With a prefix (or a FILL) argument, also fill lines where nothing has to be
+When called from a program, the rectangle's corners are START and END.
+With a prefix (or FILL) argument, also fill lines where nothing has to be
deleted."
- (interactive "r\nP")
+ (interactive "*r\nP")
(apply-on-rectangle 'delete-rectangle-line start end fill))
(defun delete-rectangle-line (startcol endcol fill)
;;;###autoload
(defun yank-rectangle ()
"Yank the last killed rectangle with upper left corner at point."
- (interactive)
+ (interactive "*")
(insert-rectangle killed-rectangle))
;; This function is untouched --dv
;;;###autoload
(defun open-rectangle (start end &optional fill)
- "Blank out rectangle with corners at point and mark (START and END when
-called from a program), shifting text right. The text previously in the region
-is not overwritten by the blanks, but instead winds up to the right of the
-rectangle.
+ "Blank out the region-rectangle, shifting text right.
-With a prefix (or a FILL) argument, fill with blanks even if there is no text
+When called from a program, the rectangle's corners are START and END.
+With a prefix (or FILL) argument, fill with blanks even if there is no text
on the right side of the rectangle."
- (interactive "r\nP")
+ (interactive "*r\nP")
(apply-on-rectangle 'open-rectangle-line start end fill)
(goto-char start))
;;;###autoload
(defun string-rectangle (start end string)
- "Insert STRING on each line of the rectangle with corners at point and mark
-(START and END when called from a program), shifting text right. The left edge
-of the rectangle specifies the column for insertion. This command does not
-delete or overwrite any existing text."
- (interactive "r\nsString rectangle: ")
+ "Insert STRING on each line of the region-rectangle, shifting text right.
+The left edge of the rectangle specifies the column for insertion. This
+command does not delete or overwrite any existing text.
+
+When called from a program, the rectangle's corners are START and END."
+ (interactive "*r\nsString rectangle: ")
(apply-on-rectangle 'string-rectangle-line start end string))
(defun string-rectangle-line (startcol endcol string)
;;;###autoload
(defun clear-rectangle (start end &optional fill)
- "Blank out the rectangle with corners at point and mark (START and END when
-called from a program). The text previously in the region is overwritten with
-blanks.
+ "Blank out the region-rectangle.
+The text previously in the region is overwritten with blanks.
-With a prefix (or a FILL) argument, also fill with blanks the parts of the
+When called from a program, the rectangle's corners are START and END.
+With a prefix (or FILL) argument, also fill with blanks the parts of the
rectangle which were empty."
- (interactive "r\nP")
+ (interactive "*r\nP")
(apply-on-rectangle 'clear-rectangle-line start end fill))
(defun clear-rectangle-line (startcol endcol fill)