diff options
| author | Richard M. Stallman <rms@gnu.org> | 1993-08-06 01:56:26 +0000 | 
|---|---|---|
| committer | Richard M. Stallman <rms@gnu.org> | 1993-08-06 01:56:26 +0000 | 
| commit | 88a2603af6cd29566444a22cee7bcbd22a13ef47 (patch) | |
| tree | db6c1c6e4507457a4ddf8225b74f0c8ab45e7d4d | |
| parent | 69b4bf37c448ae4d50fdf54d5f304ba45f57983d (diff) | |
| download | emacs-88a2603af6cd29566444a22cee7bcbd22a13ef47.tar.gz | |
(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."    "Function which is short cut to indent region using indent-according-to-mode.  A value of nil means really run indent-according-to-mode on each line.") -(defun indent-region (start end arg) +(defun indent-region (start end column)    "Indent each nonblank line in the region. -With no argument, indent each line using indent-according-to-mode. -\(If there is a fill prefix, make each line start with the fill prefix.) +With no argument, indent each line using `indent-according-to-mode', +or use `indent-region-function' to do the whole region if that's non-nil. +If there is a fill prefix, make each line start with the fill prefix.  With argument COLUMN, indent each line to that column.  Called from a program, takes three args: START, END and COLUMN."    (interactive "r\nP") -  (if (null arg) +  (if (null column)        (if fill-prefix  	  (save-excursion  	    (goto-char end)  	    (setq end (point-marker))  	    (goto-char start)  	    (let ((regexp (regexp-quote fill-prefix))) -	    (while (< (point) end) -	      (or (looking-at regexp) -		  (insert fill-prefix)) -	      (forward-line 1)))) +	      (while (< (point) end) +		(or (looking-at regexp) +		    (and (bolp) (eolp)) +		    (insert fill-prefix)) +		(forward-line 1))))  	(if indent-region-function  	    (funcall indent-region-function start end)  	  (save-excursion -	  (goto-char end) -	  (setq end (point-marker)) -	  (goto-char start) -	  (or (bolp) (forward-line 1)) -	  (while (< (point) end) -	    (funcall indent-line-function) -	    (forward-line 1)) -	  (move-marker end nil)))) -    (setq arg (prefix-numeric-value arg)) +	    (goto-char end) +	    (setq end (point-marker)) +	    (goto-char start) +	    (or (bolp) (forward-line 1)) +	    (while (< (point) end) +	      (or (and (bolp) (eolp))) +		  (funcall indent-line-function)) +	      (forward-line 1)) +	    (move-marker end nil)))) +    (setq column (prefix-numeric-value column))      (save-excursion        (goto-char end)        (setq end (point-marker)) @@ -123,7 +126,7 @@ Called from a program, takes three args: START, END and COLUMN."        (while (< (point) end)  	(delete-region (point) (progn (skip-chars-forward " \t") (point)))  	(or (eolp) -	(indent-to arg 0)) +	(indent-to column 0))  	(forward-line 1))        (move-marker end nil)))) | 
