diff options
| author | Richard M. Stallman | 1993-08-06 01:56:26 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-06 01:56:26 +0000 |
| commit | 88a2603af6cd29566444a22cee7bcbd22a13ef47 (patch) | |
| tree | db6c1c6e4507457a4ddf8225b74f0c8ab45e7d4d | |
| parent | 69b4bf37c448ae4d50fdf54d5f304ba45f57983d (diff) | |
| download | emacs-88a2603af6cd29566444a22cee7bcbd22a13ef47.tar.gz emacs-88a2603af6cd29566444a22cee7bcbd22a13ef47.zip | |
(indent-region): Rename arg ARG to COLUMN.
Don't add fill-prefix to empty line.
Don't change whitespace in empty line.
| -rw-r--r-- | lisp/indent.el | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/lisp/indent.el b/lisp/indent.el index dd6a0588453..80c8d2d1efd 100644 --- a/lisp/indent.el +++ b/lisp/indent.el | |||
| @@ -85,36 +85,39 @@ Called from a program, takes three arguments, START, END and ARG." | |||
| 85 | "Function which is short cut to indent region using indent-according-to-mode. | 85 | "Function which is short cut to indent region using indent-according-to-mode. |
| 86 | A value of nil means really run indent-according-to-mode on each line.") | 86 | A value of nil means really run indent-according-to-mode on each line.") |
| 87 | 87 | ||
| 88 | (defun indent-region (start end arg) | 88 | (defun indent-region (start end column) |
| 89 | "Indent each nonblank line in the region. | 89 | "Indent each nonblank line in the region. |
| 90 | With no argument, indent each line using indent-according-to-mode. | 90 | With no argument, indent each line using `indent-according-to-mode', |
| 91 | \(If there is a fill prefix, make each line start with the fill prefix.) | 91 | or use `indent-region-function' to do the whole region if that's non-nil. |
| 92 | If there is a fill prefix, make each line start with the fill prefix. | ||
| 92 | With argument COLUMN, indent each line to that column. | 93 | With argument COLUMN, indent each line to that column. |
| 93 | Called from a program, takes three args: START, END and COLUMN." | 94 | Called from a program, takes three args: START, END and COLUMN." |
| 94 | (interactive "r\nP") | 95 | (interactive "r\nP") |
| 95 | (if (null arg) | 96 | (if (null column) |
| 96 | (if fill-prefix | 97 | (if fill-prefix |
| 97 | (save-excursion | 98 | (save-excursion |
| 98 | (goto-char end) | 99 | (goto-char end) |
| 99 | (setq end (point-marker)) | 100 | (setq end (point-marker)) |
| 100 | (goto-char start) | 101 | (goto-char start) |
| 101 | (let ((regexp (regexp-quote fill-prefix))) | 102 | (let ((regexp (regexp-quote fill-prefix))) |
| 102 | (while (< (point) end) | 103 | (while (< (point) end) |
| 103 | (or (looking-at regexp) | 104 | (or (looking-at regexp) |
| 104 | (insert fill-prefix)) | 105 | (and (bolp) (eolp)) |
| 105 | (forward-line 1)))) | 106 | (insert fill-prefix)) |
| 107 | (forward-line 1)))) | ||
| 106 | (if indent-region-function | 108 | (if indent-region-function |
| 107 | (funcall indent-region-function start end) | 109 | (funcall indent-region-function start end) |
| 108 | (save-excursion | 110 | (save-excursion |
| 109 | (goto-char end) | 111 | (goto-char end) |
| 110 | (setq end (point-marker)) | 112 | (setq end (point-marker)) |
| 111 | (goto-char start) | 113 | (goto-char start) |
| 112 | (or (bolp) (forward-line 1)) | 114 | (or (bolp) (forward-line 1)) |
| 113 | (while (< (point) end) | 115 | (while (< (point) end) |
| 114 | (funcall indent-line-function) | 116 | (or (and (bolp) (eolp))) |
| 115 | (forward-line 1)) | 117 | (funcall indent-line-function)) |
| 116 | (move-marker end nil)))) | 118 | (forward-line 1)) |
| 117 | (setq arg (prefix-numeric-value arg)) | 119 | (move-marker end nil)))) |
| 120 | (setq column (prefix-numeric-value column)) | ||
| 118 | (save-excursion | 121 | (save-excursion |
| 119 | (goto-char end) | 122 | (goto-char end) |
| 120 | (setq end (point-marker)) | 123 | (setq end (point-marker)) |
| @@ -123,7 +126,7 @@ Called from a program, takes three args: START, END and COLUMN." | |||
| 123 | (while (< (point) end) | 126 | (while (< (point) end) |
| 124 | (delete-region (point) (progn (skip-chars-forward " \t") (point))) | 127 | (delete-region (point) (progn (skip-chars-forward " \t") (point))) |
| 125 | (or (eolp) | 128 | (or (eolp) |
| 126 | (indent-to arg 0)) | 129 | (indent-to column 0)) |
| 127 | (forward-line 1)) | 130 | (forward-line 1)) |
| 128 | (move-marker end nil)))) | 131 | (move-marker end nil)))) |
| 129 | 132 | ||