diff options
| author | Jim Blandy | 1992-05-10 18:15:10 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-05-10 18:15:10 +0000 |
| commit | e065a56e2d6322cba165ceb5c1d46cc59c5a5148 (patch) | |
| tree | 4b00ff121a271a6b9e8df84cf7eb1fb340be0e3d /lisp/textmodes | |
| parent | 1b1f8f85bf08bd6b1cdb5ca8d731ff3b12ff60d2 (diff) | |
| download | emacs-e065a56e2d6322cba165ceb5c1d46cc59c5a5148.tar.gz emacs-e065a56e2d6322cba165ceb5c1d46cc59c5a5148.zip | |
*** empty log message ***
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/fill.el | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index ad15fed9ee0..7ea751f9a37 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;; Fill commands for Emacs | 1 | ;; Fill commands for Emacs |
| 2 | ;; Copyright (C) 1985, 1986 Free Software Foundation, Inc. | 2 | ;; Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | ;; This file is part of GNU Emacs. | 4 | ;; This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -18,6 +18,13 @@ | |||
| 18 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | (defconst fill-individual-varying-indent nil | ||
| 22 | "*Controls criterion for a new paragraph in `fill-individual-paragraphs'. | ||
| 23 | Non-nil means changing indent doesn't end a paragraph. | ||
| 24 | That mode can handle paragraphs with extra indentation on the first line, | ||
| 25 | but it requires separator lines between paragraphs. | ||
| 26 | Nil means that any change in indentation starts a new paragraph.") | ||
| 27 | |||
| 21 | (defun set-fill-prefix () | 28 | (defun set-fill-prefix () |
| 22 | "Set the fill-prefix to the current line up to point. | 29 | "Set the fill-prefix to the current line up to point. |
| 23 | Filling expects lines to start with the fill prefix and | 30 | Filling expects lines to start with the fill prefix and |
| @@ -219,7 +226,13 @@ Prefix arg (non-nil third arg, if called from program) means justify as well." | |||
| 219 | 226 | ||
| 220 | (defun fill-individual-paragraphs (min max &optional justifyp mailp) | 227 | (defun fill-individual-paragraphs (min max &optional justifyp mailp) |
| 221 | "Fill each paragraph in region according to its individual fill prefix. | 228 | "Fill each paragraph in region according to its individual fill prefix. |
| 222 | Calling from a program, pass range to fill as first two arguments. | 229 | |
| 230 | If `fill-individual-varying-indent' is non-nil, | ||
| 231 | then a mere change in indentation does not end a paragraph. In this mode, | ||
| 232 | the indentation for a paragraph is the minimum indentation of any line in it. | ||
| 233 | |||
| 234 | When calling from a program, pass range to fill as first two arguments. | ||
| 235 | |||
| 223 | Optional third and fourth arguments JUSTIFY-FLAG and MAIL-FLAG: | 236 | Optional third and fourth arguments JUSTIFY-FLAG and MAIL-FLAG: |
| 224 | JUSTIFY-FLAG to justify paragraphs (prefix arg), | 237 | JUSTIFY-FLAG to justify paragraphs (prefix arg), |
| 225 | MAIL-FLAG for a mail message, i. e. don't fill header lines." | 238 | MAIL-FLAG for a mail message, i. e. don't fill header lines." |
| @@ -252,12 +265,23 @@ MAIL-FLAG for a mail message, i. e. don't fill header lines." | |||
| 252 | (forward-line 1) | 265 | (forward-line 1) |
| 253 | ;; Now stop the loop if end of paragraph. | 266 | ;; Now stop the loop if end of paragraph. |
| 254 | (and (not (eobp)) | 267 | (and (not (eobp)) |
| 268 | (if fill-individual-varying-indent | ||
| 269 | ;; If this line is a separator line, with or | ||
| 270 | ;; without prefix, end the paragraph. | ||
| 271 | (and | ||
| 255 | (not (looking-at paragraph-separate)) | 272 | (not (looking-at paragraph-separate)) |
| 256 | (save-excursion | 273 | (save-excursion |
| 257 | (not (and (looking-at fill-prefix-regexp) | 274 | (not (and (looking-at fill-prefix-regexp) |
| 258 | (progn (forward-char (length fill-prefix)) | 275 | (progn (forward-char (length fill-prefix)) |
| 259 | (looking-at paragraph-separate)))))))) | 276 | (looking-at paragraph-separate)))))) |
| 277 | ;; If this line has more or less indent | ||
| 278 | ;; than the fill prefix wants, end the paragraph. | ||
| 279 | (and (looking-at fill-prefix-regexp) | ||
| 280 | (save-excursion | ||
| 281 | (not (progn (forward-char (length fill-prefix)) | ||
| 282 | (or (looking-at paragraph-separate) | ||
| 283 | (looking-at paragraph-start)))))))))) | ||
| 260 | ;; Fill this paragraph, but don't add a newline at the end. | 284 | ;; Fill this paragraph, but don't add a newline at the end. |
| 261 | (let ((had-newline (bolp))) | 285 | (let ((had-newline (bolp))) |
| 262 | (fill-region-as-paragraph start (point) justifyp) | 286 | (fill-region-as-paragraph start (point) justifyp) |
| 263 | (or had-newline (delete-char -1)))))))) \ No newline at end of file | 287 | (or had-newline (delete-char -1)))))))) |