aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-11-11 05:30:49 +0000
committerRichard M. Stallman1995-11-11 05:30:49 +0000
commit16cf6ab20b0076d0aca0229b5346bc0ae67c85d8 (patch)
treefddb0c46d075bd4858058c702beca13f94f4bdf5
parent83f8045840c67b33ae7b8b1a079badbe6c3efef5 (diff)
downloademacs-16cf6ab20b0076d0aca0229b5346bc0ae67c85d8.tar.gz
emacs-16cf6ab20b0076d0aca0229b5346bc0ae67c85d8.zip
(fill-region-as-paragraph): Since adaptive-fill-regexp
is supposed to match text STARTING at the left margin, use `looking-at' rather than `re-search-forward'. (fill-individual-paragraphs): Match fill-prefixes starting at left-margin.
-rw-r--r--lisp/textmodes/fill.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 884aec40a7e..406d75ec089 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -145,8 +145,8 @@ This uses the variables `adapive-fill-prefix' and `adaptive-fill-function'."
145 (let ((start (point)) 145 (let ((start (point))
146 (eol (save-excursion (end-of-line) (point)))) 146 (eol (save-excursion (end-of-line) (point))))
147 (if (not (looking-at paragraph-start)) 147 (if (not (looking-at paragraph-start))
148 (cond ((re-search-forward adaptive-fill-regexp nil t) 148 (cond ((looking-at adaptive-fill-regexp)
149 (buffer-substring-no-properties start (point))) 149 (buffer-substring-no-properties start (match-end 0)))
150 (t (funcall adaptive-fill-function))))))) 150 (t (funcall adaptive-fill-function)))))))
151 151
152(defun fill-region-as-paragraph (from to &optional justify nosqueeze) 152(defun fill-region-as-paragraph (from to &optional justify nosqueeze)
@@ -768,7 +768,7 @@ MAIL-FLAG for a mail message, i. e. don't fill header lines."
768 (narrow-to-region (point) max) 768 (narrow-to-region (point) max)
769 ;; Loop over paragraphs. 769 ;; Loop over paragraphs.
770 (while (progn (skip-chars-forward " \t\n") (not (eobp))) 770 (while (progn (skip-chars-forward " \t\n") (not (eobp)))
771 (beginning-of-line) 771 (move-to-left-margin)
772 (let ((start (point)) 772 (let ((start (point))
773 fill-prefix fill-prefix-regexp) 773 fill-prefix fill-prefix-regexp)
774 ;; Find end of paragraph, and compute the smallest fill-prefix 774 ;; Find end of paragraph, and compute the smallest fill-prefix
@@ -780,13 +780,14 @@ MAIL-FLAG for a mail message, i. e. don't fill header lines."
780 (looking-at fill-prefix-regexp))) 780 (looking-at fill-prefix-regexp)))
781 (setq fill-prefix 781 (setq fill-prefix
782 (if (and adaptive-fill-mode adaptive-fill-regexp 782 (if (and adaptive-fill-mode adaptive-fill-regexp
783 (looking-at (concat "\\(" adaptive-fill-regexp "\\)"))) 783 (looking-at adaptive-fill-regexp))
784 (match-string 1) 784 (match-string 0)
785 (buffer-substring (point) 785 (buffer-substring
786 (save-excursion (skip-chars-forward " \t") (point)))) 786 (point)
787 fill-prefix-regexp 787 (save-excursion (skip-chars-forward " \t")
788 (regexp-quote fill-prefix))) 788 (point))))
789 (forward-line 1) 789 fill-prefix-regexp (regexp-quote fill-prefix)))
790 (move-to-left-margin 1)
790 ;; Now stop the loop if end of paragraph. 791 ;; Now stop the loop if end of paragraph.
791 (and (not (eobp)) 792 (and (not (eobp))
792 (if fill-individual-varying-indent 793 (if fill-individual-varying-indent