summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-11-11 05:30:49 +0000
committerRichard M. Stallman <rms@gnu.org>1995-11-11 05:30:49 +0000
commit009890e84943a17567462bf08e9029a6d68f6fb5 (patch)
tree6f9631aed2d52f494acb653b14a06c4bd52239e0 /lisp/textmodes/fill.el
parent5f2d08d26e292923add3910902e12c4b53fb6d6c (diff)
downloademacs-009890e84943a17567462bf08e9029a6d68f6fb5.tar.gz
(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.
Diffstat (limited to 'lisp/textmodes/fill.el')
-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'."
(let ((start (point))
(eol (save-excursion (end-of-line) (point))))
(if (not (looking-at paragraph-start))
- (cond ((re-search-forward adaptive-fill-regexp nil t)
- (buffer-substring-no-properties start (point)))
+ (cond ((looking-at adaptive-fill-regexp)
+ (buffer-substring-no-properties start (match-end 0)))
(t (funcall adaptive-fill-function)))))))
(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."
(narrow-to-region (point) max)
;; Loop over paragraphs.
(while (progn (skip-chars-forward " \t\n") (not (eobp)))
- (beginning-of-line)
+ (move-to-left-margin)
(let ((start (point))
fill-prefix fill-prefix-regexp)
;; 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."
(looking-at fill-prefix-regexp)))
(setq fill-prefix
(if (and adaptive-fill-mode adaptive-fill-regexp
- (looking-at (concat "\\(" adaptive-fill-regexp "\\)")))
- (match-string 1)
- (buffer-substring (point)
- (save-excursion (skip-chars-forward " \t") (point))))
- fill-prefix-regexp
- (regexp-quote fill-prefix)))
- (forward-line 1)
+ (looking-at adaptive-fill-regexp))
+ (match-string 0)
+ (buffer-substring
+ (point)
+ (save-excursion (skip-chars-forward " \t")
+ (point))))
+ fill-prefix-regexp (regexp-quote fill-prefix)))
+ (move-to-left-margin 1)
;; Now stop the loop if end of paragraph.
(and (not (eobp))
(if fill-individual-varying-indent