aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGerd Moellmann2001-04-24 10:57:05 +0000
committerGerd Moellmann2001-04-24 10:57:05 +0000
commit35f901fa576cd5950e0626ac848835c4df612329 (patch)
treeb81bce8bd5849579590a65476703d02cc14b5836 /lisp
parentc7b1b508e5f614daf0a06ea15d01928d6a303517 (diff)
downloademacs-35f901fa576cd5950e0626ac848835c4df612329.tar.gz
emacs-35f901fa576cd5950e0626ac848835c4df612329.zip
(string-rectangle): Revert to 20.x behaviour.
(replace-rectangle): Make it an alias for string-rectangle. (string-insert-rectangle): New function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/rect.el43
2 files changed, 26 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 86e4a9d6154..cdeb09ada96 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12001-04-24 Gerd Moellmann <gerd@gnu.org>
2
3 * rect.el (string-rectangle): Revert to 20.x behaviour.
4 (replace-rectangle): Make it an alias for string-rectangle.
5 (string-insert-rectangle): New function.
6
12001-04-23 John Wiegley <johnw@gnu.org> 72001-04-23 John Wiegley <johnw@gnu.org>
2 8
3 * eshell/em-unix.el (eshell/diff): Fixed problems that were 9 * eshell/em-unix.el (eshell/diff): Fixed problems that were
diff --git a/lisp/rect.el b/lisp/rect.el
index 302621776c3..4d9f034d9b6 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -1,6 +1,6 @@
1;;; rect.el --- rectangle functions for GNU Emacs. 1;;; rect.el --- rectangle functions for GNU Emacs.
2 2
3;; Copyright (C) 1985, 1999 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1999, 2000, 2001 Free Software Foundation, Inc.
4 4
5;; Maintainer: Didier Verna <verna@inf.enst.fr> 5;; Maintainer: Didier Verna <verna@inf.enst.fr>
6;; Keywords: internal 6;; Keywords: internal
@@ -305,8 +305,7 @@ on the right side of the rectangle."
305(defun delete-whitespace-rectangle-line (startcol endcol fill) 305(defun delete-whitespace-rectangle-line (startcol endcol fill)
306 (when (= (move-to-column-force startcol (or fill 'coerce)) startcol) 306 (when (= (move-to-column-force startcol (or fill 'coerce)) startcol)
307 (unless (= (point) (point-at-eol)) 307 (unless (= (point) (point-at-eol))
308 (delete-region (point) (progn (skip-syntax-forward " ") (point)))) 308 (delete-region (point) (progn (skip-syntax-forward " ") (point))))))
309 ))
310 309
311;;;###autoload (defalias 'close-rectangle 'delete-whitespace-rectangle) ;; Old name 310;;;###autoload (defalias 'close-rectangle 'delete-whitespace-rectangle) ;; Old name
312;;;###autoload 311;;;###autoload
@@ -326,22 +325,6 @@ With a prefix (or a FILL) argument, also fill too short lines."
326;; to string-rectangle-line. 325;; to string-rectangle-line.
327(defvar string-rectangle-string) 326(defvar string-rectangle-string)
328 327
329;;;###autoload
330(defun string-rectangle (start end string)
331 "Insert STRING on each line of the region-rectangle, shifting text right.
332
333When called from a program the rectangle's corners are START and END.
334The left edge of the rectangle specifies the column for insertion.
335This command does not delete or overwrite any existing text."
336 (interactive "*r\nsString rectangle: ")
337 ;; XEmacs tests `pending-delete-mode' here, and replaces the
338 ;; rectangle if that's on. Using `delete-selection-mode' here would
339 ;; only be useful if `mark-even-if-inactive' is on since otherwise
340 ;; we need the mark to be active, given the interactive spec, and
341 ;; then we'd always delete. Maybe revisit this and consider testing
342 ;; `mark-even-if-inactive' too?
343 (apply-on-rectangle 'string-rectangle-line start end string nil))
344
345(defun string-rectangle-line (startcol endcol string delete) 328(defun string-rectangle-line (startcol endcol string delete)
346 (move-to-column-force startcol) 329 (move-to-column-force startcol)
347 (if delete 330 (if delete
@@ -349,11 +332,26 @@ This command does not delete or overwrite any existing text."
349 (insert string)) 332 (insert string))
350 333
351;;;###autoload 334;;;###autoload
352(defun replace-rectangle (start end string) 335(defun string-rectangle (start end string)
353 "Like `string-rectangle', but replace the original region." 336 "Replace rectangle contents with STRING on each line.
337The length of STRING need not be the same as the rectangle width.
338
339Called from a program, takes three args; START, END and STRING."
354 (interactive "*r\nsString rectangle: ") 340 (interactive "*r\nsString rectangle: ")
355 (apply-on-rectangle 'string-rectangle-line start end string t)) 341 (apply-on-rectangle 'string-rectangle-line start end string t))
356 342
343(defalias 'replace-rectangle 'string-rectangle)
344
345;;;###autoload
346(defun string-insert-rectangle (start end string)
347 "Insert STRING on each line of region-rectangle, shifting text right.
348
349When called from a program, the rectangle's corners are START and END.
350The left edge of the rectangle specifies the column for insertion.
351This command does not delete or overwrite any existing text."
352 (interactive "*r\nsString insert rectangle: ")
353 (apply-on-rectangle 'string-rectangle-line start end string nil))
354
357;;;###autoload 355;;;###autoload
358(defun clear-rectangle (start end &optional fill) 356(defun clear-rectangle (start end &optional fill)
359 "Blank out the region-rectangle. 357 "Blank out the region-rectangle.
@@ -377,8 +375,7 @@ rectangle which were empty."
377 (move-to-column-force endcol) 375 (move-to-column-force endcol)
378 (setq spaces (- (point) pt)) 376 (setq spaces (- (point) pt))
379 (delete-region pt (point)) 377 (delete-region pt (point))
380 (indent-to (+ (current-column) spaces)))) 378 (indent-to (+ (current-column) spaces))))))
381 ))
382 379
383(provide 'rect) 380(provide 'rect)
384 381