summaryrefslogtreecommitdiff
path: root/lisp/textmodes/paragraphs.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2011-09-22 09:34:02 -0400
committerRichard M. Stallman <rms@gnu.org>2011-09-22 09:34:02 -0400
commit8f0985161467a7018ba08ccf7c9f37cc7fc3edfe (patch)
tree9e1c84e6596d8c444e1881df150130da3316f0ec /lisp/textmodes/paragraphs.el
parente74f1bb6f82eef5bc4909f25b5c10d8e7bffc090 (diff)
downloademacs-8f0985161467a7018ba08ccf7c9f37cc7fc3edfe.tar.gz
Fix bug that C-x DEL deleted a newline before paragraph.
Diffstat (limited to 'lisp/textmodes/paragraphs.el')
-rw-r--r--lisp/textmodes/paragraphs.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index a0892b5ebba..59454043c4e 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -456,21 +456,25 @@ sentences. Also, every paragraph boundary terminates sentences as well."
(sentence-end (sentence-end)))
(while (< arg 0)
(let ((pos (point))
- ;; We used to use (start-of-paragraph-text), but this can
- ;; prevent sentence-end from matching if it is anchored at
- ;; BOL and the paragraph starts indented.
- (par-beg (save-excursion (backward-paragraph) (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)))
+ (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))))
+ (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)))
(setq arg (1+ arg)))
(while (> arg 0)
(let ((par-end (save-excursion (end-of-paragraph-text) (point))))
- (if (re-search-forward sentence-end par-end t)
- (skip-chars-backward " \t\n")
- (goto-char par-end)))
+ (if (re-search-forward sentence-end par-end t)
+ (skip-chars-backward " \t\n")
+ (goto-char par-end)))
(setq arg (1- arg)))
(constrain-to-field nil opoint t)))