(fill-region-as-paragraph): Skip spaces backward
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 22 Feb 2001 20:09:13 +0000 (20:09 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 22 Feb 2001 20:09:13 +0000 (20:09 +0000)
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.

lisp/ChangeLog
lisp/textmodes/fill.el

index dd92755..7856e1a 100644 (file)
@@ -1,3 +1,8 @@
+2001-02-22  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * textmodes/fill.el (fill-region-as-paragraph): Skip spaces backward
+       rather than using (match-beginning 0) when searching for break point.
+
 2001-02-22  Eli Zaretskii  <eliz@is.elta.co.il>
 
        * textmodes/texinfmt.el (texinfo-format-scan): Signal an error if
index fedfaa9..17162ce 100644 (file)
@@ -531,7 +531,7 @@ space does not end a sentence, so don't break a line there."
                                (progn (forward-char -2) t))
                           (and fill-nobreak-predicate
                                (funcall fill-nobreak-predicate)
-                               (goto-char (match-beginning 0))))
+                               (skip-chars-backward " \t")))
                  (if (re-search-backward " \\|\\c|.\\|.\\c|" linebeg 0)
                      (forward-char 1)))
                ;; 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."
     (goto-char (match-end 0))))
 
 (defun fill-paragraph (arg)
-  "Fill paragraph at or after point.  Prefix arg means justify as well.
+  "Fill paragraph at or after point.  Prefix ARG means justify as well.
 If `sentence-end-double-space' is non-nil, then period followed by one
 space does not end a sentence, so don't break a line there.
 the variable `fill-column' controls the width for filling.
@@ -696,7 +696,7 @@ the variable `fill-column' controls the width for filling.
 If `fill-paragraph-function' is non-nil, we call it (passing our
 argument to it), and if it returns non-nil, we simply return its value.
 
-If `fill-paragraph-function' is nil, return the fill-prefix used for filling."
+If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling."
   (interactive (progn
                 (barf-if-buffer-read-only)
                 (list (if current-prefix-arg 'full))))
@@ -716,7 +716,7 @@ If `fill-paragraph-function' is nil, return the fill-prefix used for filling."
          (let ((end (point))
                (beg (progn (backward-paragraph) (point))))
            (goto-char before)
-           (setq fill-pfx 
+           (setq fill-pfx
                  (if use-hard-newlines
                      ;; Can't use fill-region-as-paragraph, since this
                      ;; paragraph may still contain hard newlines.  See