diff options
| author | Dave Love | 1999-08-23 14:28:34 +0000 |
|---|---|---|
| committer | Dave Love | 1999-08-23 14:28:34 +0000 |
| commit | e037c34cee7b2b579d764ce7cd9c50af32cd8034 (patch) | |
| tree | fa95695144f9f2176c647a649f2762e0c35983e0 | |
| parent | 2ea6666cf7299da741c2c7d61787dc21babd9cec (diff) | |
| download | emacs-e037c34cee7b2b579d764ce7cd9c50af32cd8034.tar.gz emacs-e037c34cee7b2b579d764ce7cd9c50af32cd8034.zip | |
Add/fix various doc strings. Add `*' to all the interactive specs.
| -rw-r--r-- | lisp/rect.el | 76 |
1 files changed, 41 insertions, 35 deletions
diff --git a/lisp/rect.el b/lisp/rect.el index 437f030395d..1e1a9baa851 100644 --- a/lisp/rect.el +++ b/lisp/rect.el | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; This package provides the operations on rectangles that are ocumented | 27 | ;; This package provides the operations on rectangles that are documented |
| 28 | ;; in the Emacs manual. | 28 | ;; in the Emacs manual. |
| 29 | 29 | ||
| 30 | ;; ### NOTE: this file has been almost completely rewritten by Didier Verna | 30 | ;; ### NOTE: this file has been almost completely rewritten by Didier Verna |
| @@ -111,7 +111,7 @@ Point is at the end of the segment of this line within the rectangle." | |||
| 111 | (defun apply-on-rectangle (function start end &rest args) | 111 | (defun apply-on-rectangle (function start end &rest args) |
| 112 | "Call FUNCTION for each line of rectangle with corners at START, END. | 112 | "Call FUNCTION for each line of rectangle with corners at START, END. |
| 113 | FUNCTION is called with two arguments: the start and end columns of the | 113 | FUNCTION is called with two arguments: the start and end columns of the |
| 114 | rectangle, plus ARGS extra arguments. Point is at the beginning of line when | 114 | rectangle, plus ARGS extra arguments. Point is at the beginning of line when |
| 115 | the function is called." | 115 | the function is called." |
| 116 | (let (startcol startpt endcol endpt) | 116 | (let (startcol startpt endcol endpt) |
| 117 | (save-excursion | 117 | (save-excursion |
| @@ -203,21 +203,23 @@ the function is called." | |||
| 203 | 203 | ||
| 204 | ;;;###autoload | 204 | ;;;###autoload |
| 205 | (defun delete-rectangle (start end &optional fill) | 205 | (defun delete-rectangle (start end &optional fill) |
| 206 | "Delete (don't save) text in rectangle with corners at point and mark (START | 206 | "Delete (don't save) text in the region-rectangle. |
| 207 | and END when called from a program). The same range of columns is deleted in | 207 | The same range of columns is deleted in each line starting with the |
| 208 | each line starting with the line where the region begins and ending with the | 208 | line where the region begins and ending with the line where the region |
| 209 | line where the region ends. | 209 | ends. |
| 210 | 210 | ||
| 211 | With a prefix (or a FILL) argument, also fill lines where nothing has to be | 211 | When called from a program the rectangle's corners are START and END. |
| 212 | deleted." | 212 | With a prefix (or a FILL) argument, also fill lines where nothing has |
| 213 | (interactive "r\nP") | 213 | to be deleted." |
| 214 | (interactive "*r\nP") | ||
| 214 | (apply-on-rectangle 'delete-rectangle-line start end fill)) | 215 | (apply-on-rectangle 'delete-rectangle-line start end fill)) |
| 215 | 216 | ||
| 216 | ;;;###autoload | 217 | ;;;###autoload |
| 217 | (defun delete-extract-rectangle (start end &optional fill) | 218 | (defun delete-extract-rectangle (start end &optional fill) |
| 218 | "Delete the contents of the rectangle with corners at START and END, and | 219 | "Delete the contents of the region-rectangle. |
| 219 | return it as a list of strings, one for each line of the rectangle. | 220 | Return it as a list of strings, one for each line of the rectangle. |
| 220 | 221 | ||
| 222 | When called from a program the rectangle's corners are START and END. | ||
| 221 | With an optional FILL argument, also fill lines where nothing has to be | 223 | With an optional FILL argument, also fill lines where nothing has to be |
| 222 | deleted." | 224 | deleted." |
| 223 | (let ((lines (list nil))) | 225 | (let ((lines (list nil))) |
| @@ -226,24 +228,25 @@ deleted." | |||
| 226 | 228 | ||
| 227 | ;;;###autoload | 229 | ;;;###autoload |
| 228 | (defun extract-rectangle (start end) | 230 | (defun extract-rectangle (start end) |
| 229 | "Return the contents of the rectangle with corners at START and END, | 231 | "Return the contents of the rectangle with corners at START and END. |
| 230 | as a list of strings, one for each line of the rectangle." | 232 | Return it as a list of strings, one for each line of the rectangle." |
| 231 | (let ((lines (list nil))) | 233 | (let ((lines (list nil))) |
| 232 | (apply-on-rectangle 'extract-rectangle-line start end lines) | 234 | (apply-on-rectangle 'extract-rectangle-line start end lines) |
| 233 | (nreverse (cdr lines)))) | 235 | (nreverse (cdr lines)))) |
| 234 | 236 | ||
| 235 | (defvar killed-rectangle nil | 237 | (defvar killed-rectangle nil |
| 236 | "Rectangle for yank-rectangle to insert.") | 238 | "Rectangle for `yank-rectangle' to insert.") |
| 237 | 239 | ||
| 238 | ;;;###autoload | 240 | ;;;###autoload |
| 239 | (defun kill-rectangle (start end &optional fill) | 241 | (defun kill-rectangle (start end &optional fill) |
| 240 | "Delete the rectangle with corners at point and mark (START and END when | 242 | "Delete the region-rectangle and save it as the last killed one. |
| 241 | called from a program) and save it as the last killed one. You might prefer to | 243 | |
| 242 | use `delete-extract-rectangle' from a program. | 244 | When called from a program the rectangle's corners are START and END. |
| 245 | You might prefer to use `delete-extract-rectangle' from a program. | ||
| 243 | 246 | ||
| 244 | With a prefix (or a FILL) argument, also fill lines where nothing has to be | 247 | With a prefix (or a FILL) argument, also fill lines where nothing has to be |
| 245 | deleted." | 248 | deleted." |
| 246 | (interactive "r\nP") | 249 | (interactive "*r\nP") |
| 247 | (when buffer-read-only | 250 | (when buffer-read-only |
| 248 | (setq killed-rectangle (extract-rectangle start end)) | 251 | (setq killed-rectangle (extract-rectangle start end)) |
| 249 | (barf-if-buffer-read-only)) | 252 | (barf-if-buffer-read-only)) |
| @@ -253,7 +256,7 @@ deleted." | |||
| 253 | ;;;###autoload | 256 | ;;;###autoload |
| 254 | (defun yank-rectangle () | 257 | (defun yank-rectangle () |
| 255 | "Yank the last killed rectangle with upper left corner at point." | 258 | "Yank the last killed rectangle with upper left corner at point." |
| 256 | (interactive) | 259 | (interactive "*") |
| 257 | (insert-rectangle killed-rectangle)) | 260 | (insert-rectangle killed-rectangle)) |
| 258 | 261 | ||
| 259 | ;; this one is untoutched --dv | 262 | ;; this one is untoutched --dv |
| @@ -281,14 +284,15 @@ and point is at the lower right corner." | |||
| 281 | 284 | ||
| 282 | ;;;###autoload | 285 | ;;;###autoload |
| 283 | (defun open-rectangle (start end &optional fill) | 286 | (defun open-rectangle (start end &optional fill) |
| 284 | "Blank out rectangle with corners at point and mark (START and END when | 287 | "Blank out the region-rectangle, shifting text right. |
| 285 | called from a program), shifting text right. The text previously in the region | 288 | |
| 286 | is not overwritten by the blanks, but instead winds up to the right of the | 289 | The text previously in the region is not overwritten by the blanks, |
| 287 | rectangle. | 290 | but instead winds up to the right of the rectangle. |
| 288 | 291 | ||
| 292 | When called from a program the rectangle's corners are START and END. | ||
| 289 | With a prefix (or a FILL) argument, fill with blanks even if there is no text | 293 | With a prefix (or a FILL) argument, fill with blanks even if there is no text |
| 290 | on the right side of the rectangle." | 294 | on the right side of the rectangle." |
| 291 | (interactive "r\nP") | 295 | (interactive "*r\nP") |
| 292 | (apply-on-rectangle 'open-rectangle-line start end fill) | 296 | (apply-on-rectangle 'open-rectangle-line start end fill) |
| 293 | (goto-char start)) | 297 | (goto-char start)) |
| 294 | 298 | ||
| @@ -314,8 +318,9 @@ The left edge of the rectangle specifies the position in each line | |||
| 314 | at which whitespace deletion should begin. On each line in the | 318 | at which whitespace deletion should begin. On each line in the |
| 315 | rectangle, all continuous whitespace starting at that column is deleted. | 319 | rectangle, all continuous whitespace starting at that column is deleted. |
| 316 | 320 | ||
| 321 | When called from a program the rectangle's corners are START and END. | ||
| 317 | With a prefix (or a FILL) argument, also fill too short lines." | 322 | With a prefix (or a FILL) argument, also fill too short lines." |
| 318 | (interactive "r\nP") | 323 | (interactive "*r\nP") |
| 319 | (apply-on-rectangle 'delete-whitespace-rectangle-line start end fill)) | 324 | (apply-on-rectangle 'delete-whitespace-rectangle-line start end fill)) |
| 320 | 325 | ||
| 321 | ;; not used any more --dv | 326 | ;; not used any more --dv |
| @@ -325,11 +330,12 @@ With a prefix (or a FILL) argument, also fill too short lines." | |||
| 325 | 330 | ||
| 326 | ;;;###autoload | 331 | ;;;###autoload |
| 327 | (defun string-rectangle (start end string) | 332 | (defun string-rectangle (start end string) |
| 328 | "Insert STRING on each line of the rectangle with corners at point and mark | 333 | "Insert STRING on each line of the region-rectangle, shifting text right. |
| 329 | (START and END when called from a program), shifting text right. The left edge | 334 | |
| 330 | of the rectangle specifies the column for insertion. This command does not | 335 | When called from a program the rectangle's corners are START and END. |
| 331 | delete or overwrite any existing text." | 336 | The left edge of the rectangle specifies the column for insertion. |
| 332 | (interactive "r\nsString rectangle: ") | 337 | This command does not delete or overwrite any existing text." |
| 338 | (interactive "*r\nsString rectangle: ") | ||
| 333 | (apply-on-rectangle 'string-rectangle-line start end string)) | 339 | (apply-on-rectangle 'string-rectangle-line start end string)) |
| 334 | 340 | ||
| 335 | (defun string-rectangle-line (startcol endcol string) | 341 | (defun string-rectangle-line (startcol endcol string) |
| @@ -338,13 +344,13 @@ delete or overwrite any existing text." | |||
| 338 | 344 | ||
| 339 | ;;;###autoload | 345 | ;;;###autoload |
| 340 | (defun clear-rectangle (start end &optional fill) | 346 | (defun clear-rectangle (start end &optional fill) |
| 341 | "Blank out the rectangle with corners at point and mark (START and END when | 347 | "Blank out the region-rectangle. |
| 342 | called from a program). The text previously in the region is overwritten with | 348 | The text previously in the region is overwritten with blanks. |
| 343 | blanks. | ||
| 344 | 349 | ||
| 350 | When called from a program the rectangle's corners are START and END. | ||
| 345 | With a prefix (or a FILL) argument, also fill with blanks the parts of the | 351 | With a prefix (or a FILL) argument, also fill with blanks the parts of the |
| 346 | rectangle which were empty." | 352 | rectangle which were empty." |
| 347 | (interactive "r\nP") | 353 | (interactive "*r\nP") |
| 348 | (apply-on-rectangle 'clear-rectangle-line start end fill)) | 354 | (apply-on-rectangle 'clear-rectangle-line start end fill)) |
| 349 | 355 | ||
| 350 | (defun clear-rectangle-line (startcol endcol fill) | 356 | (defun clear-rectangle-line (startcol endcol fill) |