(string-rectangle): Revert to 20.x behaviour.
(replace-rectangle): Make it an alias for string-rectangle. (string-insert-rectangle): New function.
This commit is contained in:
parent
c7b1b508e5
commit
35f901fa57
2 changed files with 26 additions and 23 deletions
|
@ -1,3 +1,9 @@
|
|||
2001-04-24 Gerd Moellmann <gerd@gnu.org>
|
||||
|
||||
* rect.el (string-rectangle): Revert to 20.x behaviour.
|
||||
(replace-rectangle): Make it an alias for string-rectangle.
|
||||
(string-insert-rectangle): New function.
|
||||
|
||||
2001-04-23 John Wiegley <johnw@gnu.org>
|
||||
|
||||
* eshell/em-unix.el (eshell/diff): Fixed problems that were
|
||||
|
|
43
lisp/rect.el
43
lisp/rect.el
|
@ -1,6 +1,6 @@
|
|||
;;; rect.el --- rectangle functions for GNU Emacs.
|
||||
|
||||
;; Copyright (C) 1985, 1999 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1985, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
;; Maintainer: Didier Verna <verna@inf.enst.fr>
|
||||
;; Keywords: internal
|
||||
|
@ -305,8 +305,7 @@ on the right side of the rectangle."
|
|||
(defun delete-whitespace-rectangle-line (startcol endcol fill)
|
||||
(when (= (move-to-column-force startcol (or fill 'coerce)) startcol)
|
||||
(unless (= (point) (point-at-eol))
|
||||
(delete-region (point) (progn (skip-syntax-forward " ") (point))))
|
||||
))
|
||||
(delete-region (point) (progn (skip-syntax-forward " ") (point))))))
|
||||
|
||||
;;;###autoload (defalias 'close-rectangle 'delete-whitespace-rectangle) ;; Old name
|
||||
;;;###autoload
|
||||
|
@ -326,22 +325,6 @@ With a prefix (or a FILL) argument, also fill too short lines."
|
|||
;; to string-rectangle-line.
|
||||
(defvar string-rectangle-string)
|
||||
|
||||
;;;###autoload
|
||||
(defun string-rectangle (start end string)
|
||||
"Insert STRING on each line of the region-rectangle, shifting text right.
|
||||
|
||||
When called from a program the rectangle's corners are START and END.
|
||||
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: ")
|
||||
;; XEmacs tests `pending-delete-mode' here, and replaces the
|
||||
;; rectangle if that's on. Using `delete-selection-mode' here would
|
||||
;; only be useful if `mark-even-if-inactive' is on since otherwise
|
||||
;; we need the mark to be active, given the interactive spec, and
|
||||
;; then we'd always delete. Maybe revisit this and consider testing
|
||||
;; `mark-even-if-inactive' too?
|
||||
(apply-on-rectangle 'string-rectangle-line start end string nil))
|
||||
|
||||
(defun string-rectangle-line (startcol endcol string delete)
|
||||
(move-to-column-force startcol)
|
||||
(if delete
|
||||
|
@ -349,11 +332,26 @@ This command does not delete or overwrite any existing text."
|
|||
(insert string))
|
||||
|
||||
;;;###autoload
|
||||
(defun replace-rectangle (start end string)
|
||||
"Like `string-rectangle', but replace the original region."
|
||||
(defun string-rectangle (start end string)
|
||||
"Replace rectangle contents with STRING on each line.
|
||||
The length of STRING need not be the same as the rectangle width.
|
||||
|
||||
Called from a program, takes three args; START, END and STRING."
|
||||
(interactive "*r\nsString rectangle: ")
|
||||
(apply-on-rectangle 'string-rectangle-line start end string t))
|
||||
|
||||
(defalias 'replace-rectangle 'string-rectangle)
|
||||
|
||||
;;;###autoload
|
||||
(defun string-insert-rectangle (start end string)
|
||||
"Insert STRING on each line of region-rectangle, shifting text right.
|
||||
|
||||
When called from a program, the rectangle's corners are START and END.
|
||||
The left edge of the rectangle specifies the column for insertion.
|
||||
This command does not delete or overwrite any existing text."
|
||||
(interactive "*r\nsString insert rectangle: ")
|
||||
(apply-on-rectangle 'string-rectangle-line start end string nil))
|
||||
|
||||
;;;###autoload
|
||||
(defun clear-rectangle (start end &optional fill)
|
||||
"Blank out the region-rectangle.
|
||||
|
@ -377,8 +375,7 @@ rectangle which were empty."
|
|||
(move-to-column-force endcol)
|
||||
(setq spaces (- (point) pt))
|
||||
(delete-region pt (point))
|
||||
(indent-to (+ (current-column) spaces))))
|
||||
))
|
||||
(indent-to (+ (current-column) spaces))))))
|
||||
|
||||
(provide 'rect)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue