]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/paragraphs.el
* indent.el (indent-for-tab-command): Fix typo in docstring.
[gnu-emacs] / lisp / textmodes / paragraphs.el
index 231eba6ba86b5ba8000220f9b2272f5552a1d1fe..ca141c1b671225625f9ed340624be4515d862009 100644 (file)
@@ -1,17 +1,17 @@
 ;;; paragraphs.el --- paragraph and sentence parsing
 
 ;; Copyright (C) 1985, 1986, 1987, 1991, 1994, 1995, 1996, 1997, 1999, 2000,
-;;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: wp
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -185,14 +183,15 @@ end of a sentence, the ending period, question mark, or exclamation point
 must be followed by two spaces, with perhaps some closing delimiters
 in between.  See Info node `(elisp)Standard Regexps'."
   (or sentence-end
-      (concat (if sentence-end-without-period "\\w  \\|")
+      ;; We accept non-break space along with space.
+      (concat (if sentence-end-without-period "\\w[ \u00a0][ \u00a0]\\|")
              "\\("
              sentence-end-base
               (if sentence-end-double-space
-                  "\\($\\| $\\|\t\\|  \\)" "\\($\\|[\t ]\\)")
+                  "\\($\\|[ \u00a0]$\\|\t\\|[ \u00a0][ \u00a0]\\)" "\\($\\|[\t \u00a0]\\)")
               "\\|[" sentence-end-without-space "]+"
              "\\)"
-              "[ \t\n]*")))
+              "[ \u00a0\t\n]*")))
 
 (defcustom page-delimiter "^\014"
   "Regexp describing line-beginnings that separate pages."
@@ -355,8 +354,8 @@ With argument ARG, do it ARG times;
 a negative argument ARG = -N means move forward N paragraphs.
 
 A paragraph start is the beginning of a line which is a
-`first-line-of-paragraph' or which is ordinary text and follows a
-paragraph-separating line; except: if the first real line of a
+`paragraph-start' or which is ordinary text and follows a
+`paragraph-separate'ing line; except: if the first real line of a
 paragraph is preceded by a blank line, the paragraph starts at that
 blank line.
 
@@ -451,7 +450,10 @@ 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) (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)))