]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/paragraphs.el
progmodes/cc-menus.el (cc-imenu-c++-generic-expression): Make it handle
[gnu-emacs] / lisp / textmodes / paragraphs.el
index 70f11cf66dc80adecb39e3a760a42b2f24bca25d..59454043c4ed45a3ac2967e6baa55978cd783955 100644 (file)
@@ -43,7 +43,7 @@ only considered as a candidate to match `paragraph-start' or
 
 Prefix argument says to turn mode on if positive, off if negative.
 When the mode is turned on, if there are newlines in the buffer but no hard
-newlines, ask the user whether to mark as hard any newlines preceeding a
+newlines, ask the user whether to mark as hard any newlines preceding a
 `paragraph-start' line.  From a program, second arg INSERT specifies whether
 to do this; it can be `never' to change nothing, t or `always' to force
 marking, `guess' to try to do the right thing with no questions, nil
@@ -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)))