-;;;###autoload
-(defvar killed-rectangle nil
- "Rectangle for `yank-rectangle' to insert.")
-
-;;;###autoload
-(defun kill-rectangle (start end &optional fill)
- "Delete the region-rectangle and save it as the last killed one.
-You might prefer to use `delete-extract-rectangle' from a program.
-
-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")
- (when buffer-read-only
- (setq killed-rectangle (extract-rectangle start end))
- (barf-if-buffer-read-only))
- (setq killed-rectangle (delete-extract-rectangle start end fill)))
-
-;;;###autoload
-(defun delete-rectangle (start end &optional fill)
- "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.
-
-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")
- (apply-on-rectangle 'delete-rectangle-line start end fill))
-
-(defun delete-rectangle-line (startcol endcol fill)
- (let ((pt (point-at-eol)))
- (when (= (move-to-column startcol (or fill 'coerce)) startcol)
- (if (and (not fill) (<= pt endcol))
- (delete-region (point) pt)
- ;; else
- (setq pt (point))
- (move-to-column endcol t)
- (delete-region pt (point))))
- ))
-
-;;;###autoload
-(defun delete-extract-rectangle (start end &optional fill)
- "Delete the contents of the rectangle with corners at START and END, and
-return it as a list of strings, one for each line of the rectangle.
-
-With an optional FILL argument, also fill lines where nothing has to be
-deleted."
- (let ((lines (list nil)))
- (apply-on-rectangle 'delete-extract-rectangle-line start end lines fill)
- (nreverse (cdr lines))))