Mercurial > emacs
comparison lisp/rect.el @ 2637:45ecb9b4a6da
(string-rectangle): Renamed from fill-rectangle.
(string-rectangle-line): Renamed from fill-rectangle-line.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 03 May 1993 15:01:18 +0000 |
parents | e67f6d2679e3 |
children | bef3a67ac893 |
comparison
equal
deleted
inserted
replaced
2636:0b90475af405 | 2637:45ecb9b4a6da |
---|---|
190 (progn (skip-chars-backward " \t" startpos) | 190 (progn (skip-chars-backward " \t" startpos) |
191 (point))) | 191 (point))) |
192 (indent-to column))) | 192 (indent-to column))) |
193 | 193 |
194 ;;;###autoload | 194 ;;;###autoload |
195 (defun fill-rectangle (start end text) | 195 (defun string-rectangle (start end string) |
196 "Fill each line of the rectangle with corners at point and mark with | 196 "Insert STRING on each line of the region-rectangle, shifting text right. |
197 text, shifting text right. The text previously in the region is not | 197 The left edge of the rectangle specifies the column for insertion. |
198 overwritten by the blanks, but instead winds up to the right of the | 198 This command does not delete or overwrite any existing text. |
199 rectangle. Called from a program, takes three args; START, END and | 199 |
200 TEXT." | 200 Called from a program, takes three args; START, END and STRING." |
201 (interactive "r\nsText:") | 201 (interactive "r\nsString rectangle: ") |
202 (operate-on-rectangle 'fill-rectangle-line start end nil) | 202 (operate-on-rectangle 'string-rectangle-line start end nil) |
203 (goto-char start)) | 203 (goto-char start)) |
204 | 204 |
205 (defun fill-rectangle-line (startpos begextra endextra) | 205 (defun string-rectangle-line (startpos begextra endextra) |
206 (let ((column (+ (current-column) begextra endextra))) | 206 (let ((column (+ (current-column) begextra endextra))) |
207 (goto-char startpos) | 207 (goto-char startpos) |
208 (let ((ocol (current-column))) | 208 (let ((ocol (current-column))) |
209 (skip-chars-forward " \t") | 209 (skip-chars-forward " \t") |
210 (setq column (+ column (- (current-column) ocol)))) | 210 (setq column (+ column (- (current-column) ocol)))) |
211 (delete-region (point) | 211 (delete-region (point) |
212 ;; Use skip-chars-backward's LIM argument to leave | 212 ;; Use skip-chars-backward's LIM argument to leave |
213 ;; characters before STARTPOS undisturbed. | 213 ;; characters before STARTPOS undisturbed. |
214 (progn (skip-chars-backward " \t" startpos) | 214 (progn (skip-chars-backward " \t" startpos) |
215 (point))) | 215 (point))) |
216 (insert text))) | 216 (insert string))) |
217 | 217 |
218 ;;;###autoload | 218 ;;;###autoload |
219 (defun clear-rectangle (start end) | 219 (defun clear-rectangle (start end) |
220 "Blank out rectangle with corners at point and mark. | 220 "Blank out rectangle with corners at point and mark. |
221 The text previously in the region is overwritten by the blanks. | 221 The text previously in the region is overwritten by the blanks. |