aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-02-22 20:09:13 +0000
committerStefan Monnier2001-02-22 20:09:13 +0000
commitcb91b2c7eec8e3139734d760c0f3583e9c3b6416 (patch)
tree4ba6d33b9ac34713468d75057343cbdbff3556b0
parent8b3f7f7d93a8986298d06963d0a0d49f8ecb1188 (diff)
downloademacs-cb91b2c7eec8e3139734d760c0f3583e9c3b6416.tar.gz
emacs-cb91b2c7eec8e3139734d760c0f3583e9c3b6416.zip
(fill-region-as-paragraph): Skip spaces backward
rather than using (match-beginning 0) when searching for break point. Because match-data might have been destroyed by fill-nobreak-predicate or might never have been setup if the re-search-backward has failed.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/textmodes/fill.el8
2 files changed, 9 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dd927559b4d..7856e1a4ebe 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12001-02-22 Stefan Monnier <monnier@cs.yale.edu>
2
3 * textmodes/fill.el (fill-region-as-paragraph): Skip spaces backward
4 rather than using (match-beginning 0) when searching for break point.
5
12001-02-22 Eli Zaretskii <eliz@is.elta.co.il> 62001-02-22 Eli Zaretskii <eliz@is.elta.co.il>
2 7
3 * textmodes/texinfmt.el (texinfo-format-scan): Signal an error if 8 * textmodes/texinfmt.el (texinfo-format-scan): Signal an error if
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index fedfaa91999..17162ceac8a 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -531,7 +531,7 @@ space does not end a sentence, so don't break a line there."
531 (progn (forward-char -2) t)) 531 (progn (forward-char -2) t))
532 (and fill-nobreak-predicate 532 (and fill-nobreak-predicate
533 (funcall fill-nobreak-predicate) 533 (funcall fill-nobreak-predicate)
534 (goto-char (match-beginning 0)))) 534 (skip-chars-backward " \t")))
535 (if (re-search-backward " \\|\\c|.\\|.\\c|" linebeg 0) 535 (if (re-search-backward " \\|\\c|.\\|.\\c|" linebeg 0)
536 (forward-char 1))) 536 (forward-char 1)))
537 ;; If the left margin and fill prefix by themselves 537 ;; If the left margin and fill prefix by themselves
@@ -688,7 +688,7 @@ space does not end a sentence, so don't break a line there."
688 (goto-char (match-end 0)))) 688 (goto-char (match-end 0))))
689 689
690(defun fill-paragraph (arg) 690(defun fill-paragraph (arg)
691 "Fill paragraph at or after point. Prefix arg means justify as well. 691 "Fill paragraph at or after point. Prefix ARG means justify as well.
692If `sentence-end-double-space' is non-nil, then period followed by one 692If `sentence-end-double-space' is non-nil, then period followed by one
693space does not end a sentence, so don't break a line there. 693space does not end a sentence, so don't break a line there.
694the variable `fill-column' controls the width for filling. 694the variable `fill-column' controls the width for filling.
@@ -696,7 +696,7 @@ the variable `fill-column' controls the width for filling.
696If `fill-paragraph-function' is non-nil, we call it (passing our 696If `fill-paragraph-function' is non-nil, we call it (passing our
697argument to it), and if it returns non-nil, we simply return its value. 697argument to it), and if it returns non-nil, we simply return its value.
698 698
699If `fill-paragraph-function' is nil, return the fill-prefix used for filling." 699If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling."
700 (interactive (progn 700 (interactive (progn
701 (barf-if-buffer-read-only) 701 (barf-if-buffer-read-only)
702 (list (if current-prefix-arg 'full)))) 702 (list (if current-prefix-arg 'full))))
@@ -716,7 +716,7 @@ If `fill-paragraph-function' is nil, return the fill-prefix used for filling."
716 (let ((end (point)) 716 (let ((end (point))
717 (beg (progn (backward-paragraph) (point)))) 717 (beg (progn (backward-paragraph) (point))))
718 (goto-char before) 718 (goto-char before)
719 (setq fill-pfx 719 (setq fill-pfx
720 (if use-hard-newlines 720 (if use-hard-newlines
721 ;; Can't use fill-region-as-paragraph, since this 721 ;; Can't use fill-region-as-paragraph, since this
722 ;; paragraph may still contain hard newlines. See 722 ;; paragraph may still contain hard newlines. See