diff options
| author | Stefan Monnier | 2001-02-22 20:09:13 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-02-22 20:09:13 +0000 |
| commit | cb91b2c7eec8e3139734d760c0f3583e9c3b6416 (patch) | |
| tree | 4ba6d33b9ac34713468d75057343cbdbff3556b0 | |
| parent | 8b3f7f7d93a8986298d06963d0a0d49f8ecb1188 (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/textmodes/fill.el | 8 |
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 @@ | |||
| 1 | 2001-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 | |||
| 1 | 2001-02-22 Eli Zaretskii <eliz@is.elta.co.il> | 6 | 2001-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. |
| 692 | If `sentence-end-double-space' is non-nil, then period followed by one | 692 | If `sentence-end-double-space' is non-nil, then period followed by one |
| 693 | space does not end a sentence, so don't break a line there. | 693 | space does not end a sentence, so don't break a line there. |
| 694 | the variable `fill-column' controls the width for filling. | 694 | the variable `fill-column' controls the width for filling. |
| @@ -696,7 +696,7 @@ the variable `fill-column' controls the width for filling. | |||
| 696 | If `fill-paragraph-function' is non-nil, we call it (passing our | 696 | If `fill-paragraph-function' is non-nil, we call it (passing our |
| 697 | argument to it), and if it returns non-nil, we simply return its value. | 697 | argument to it), and if it returns non-nil, we simply return its value. |
| 698 | 698 | ||
| 699 | If `fill-paragraph-function' is nil, return the fill-prefix used for filling." | 699 | If `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 |