summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/fill.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 85b16931ec8..4e45c164ae8 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -159,6 +159,11 @@ Leave one space between words, two at end of sentences or after colons
and `sentence-end-without-period').
Remove indentation from each line."
(interactive "*r")
+ ;; Ideally, we'd want to scan the text from the end, so that changes to
+ ;; text don't affect the boundary, but the regexp we match against does
+ ;; not match as eagerly when matching backward, so we instead use
+ ;; a marker.
+ (unless (markerp end) (setq end (copy-marker end t)))
(let ((end-spc-re (concat "\\(" (sentence-end) "\\) *\\| +")))
(save-excursion
(goto-char beg)