summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1992-05-10 18:15:10 +0000
committerJim Blandy <jimb@redhat.com>1992-05-10 18:15:10 +0000
commite065a56e2d6322cba165ceb5c1d46cc59c5a5148 (patch)
tree4b00ff121a271a6b9e8df84cf7eb1fb340be0e3d /lisp/textmodes
parent1b1f8f85bf08bd6b1cdb5ca8d731ff3b12ff60d2 (diff)
downloademacs-e065a56e2d6322cba165ceb5c1d46cc59c5a5148.tar.gz
*** empty log message ***
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/fill.el32
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 @@
;; Fill commands for Emacs
-;; Copyright (C) 1985, 1986 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
@@ -18,6 +18,13 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+(defconst fill-individual-varying-indent nil
+ "*Controls criterion for a new paragraph in `fill-individual-paragraphs'.
+Non-nil means changing indent doesn't end a paragraph.
+That mode can handle paragraphs with extra indentation on the first line,
+but it requires separator lines between paragraphs.
+Nil means that any change in indentation starts a new paragraph.")
+
(defun set-fill-prefix ()
"Set the fill-prefix to the current line up to point.
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."
(defun fill-individual-paragraphs (min max &optional justifyp mailp)
"Fill each paragraph in region according to its individual fill prefix.
-Calling from a program, pass range to fill as first two arguments.
+
+If `fill-individual-varying-indent' is non-nil,
+then a mere change in indentation does not end a paragraph. In this mode,
+the indentation for a paragraph is the minimum indentation of any line in it.
+
+When calling from a program, pass range to fill as first two arguments.
+
Optional third and fourth arguments JUSTIFY-FLAG and MAIL-FLAG:
JUSTIFY-FLAG to justify paragraphs (prefix arg),
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."
(forward-line 1)
;; Now stop the loop if end of paragraph.
(and (not (eobp))
+ (if fill-individual-varying-indent
+ ;; If this line is a separator line, with or
+ ;; without prefix, end the paragraph.
+ (and
(not (looking-at paragraph-separate))
(save-excursion
(not (and (looking-at fill-prefix-regexp)
(progn (forward-char (length fill-prefix))
- (looking-at paragraph-separate))))))))
+ (looking-at paragraph-separate))))))
+ ;; If this line has more or less indent
+ ;; than the fill prefix wants, end the paragraph.
+ (and (looking-at fill-prefix-regexp)
+ (save-excursion
+ (not (progn (forward-char (length fill-prefix))
+ (or (looking-at paragraph-separate)
+ (looking-at paragraph-start))))))))))
;; Fill this paragraph, but don't add a newline at the end.
(let ((had-newline (bolp)))
(fill-region-as-paragraph start (point) justifyp)
- (or had-newline (delete-char -1)))))))) \ No newline at end of file
+ (or had-newline (delete-char -1))))))))