summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2011-09-23 19:55:52 -0400
committerRichard M. Stallman <rms@gnu.org>2011-09-23 19:55:52 -0400
commite488d29cecd63f466c3a27ce9970715e28c330da (patch)
treeff468694076503371f083a86b5b5225f779e8fe4
parent19c38752456e0ead97d9db529152300171d6022c (diff)
downloademacs-e488d29cecd63f466c3a27ce9970715e28c330da.tar.gz
For moving backward sentences,
distinguish start of paragraph from start of its text.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/textmodes/paragraphs.el22
2 files changed, 16 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1c21b12b8de..a7e9afc96c6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2011-09-23 Richard Stallman <rms@gnu.org>
+ * textmodes/paragraphs.el (forward-sentence): For backwards case,
+ distinguish start of paragraph from start of its text.
+
* mail/emacsbug.el (report-emacs-bug-query-existing-bugs): Autoload.
* mail/rmail.el (rmail-view-buffer-kill-buffer-hook): New function.
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 59454043c4e..8fd055f7d87 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -456,19 +456,23 @@ sentences. Also, every paragraph boundary terminates sentences as well."
(sentence-end (sentence-end)))
(while (< arg 0)
(let ((pos (point))
- (par-beg
- (save-excursion
- (start-of-paragraph-text)
- ;; Move PAR-BEG back over indentation
- ;; to allow s1entence-end to match if it is anchored at
- ;; BOL and the paragraph starts indented.
- (beginning-of-line)
- (point))))
+ par-beg par-text-beg)
+ (save-excursion
+ (start-of-paragraph-text)
+ ;; Start of real text in the paragraph.
+ ;; We move back to here if we don't see a sentence-end.
+ (setq par-text-beg (point))
+ ;; Start of the first line of the paragraph.
+ ;; We use this as the search limit
+ ;; to allow s1entence-end to match if it is anchored at
+ ;; BOL and the paragraph starts indented.
+ (beginning-of-line)
+ (setq par-beg (point)))
(if (and (re-search-backward sentence-end par-beg t)
(or (< (match-end 0) pos)
(re-search-backward sentence-end par-beg t)))
(goto-char (match-end 0))
- (goto-char par-beg)))
+ (goto-char par-text-beg)))
(setq arg (1+ arg)))
(while (> arg 0)
(let ((par-end (save-excursion (end-of-paragraph-text) (point))))