;;; paragraphs.el --- paragraph and sentence parsing
-;; Copyright (C) 1985, 86, 87, 91, 94, 95, 96, 1997, 1999, 2000, 2001
+;; Copyright (C) 1985, 86, 87, 91, 94, 95, 96, 1997, 1999, 2000, 2001, 2004
;; Free Software Foundation, Inc.
;; Maintainer: FSF
;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
and `colon-double-space'.
This value is used by the function `sentence-end' to construct the
-regexp describing the end of a sentence, in case when the value of
-the variable `sentence-end' is nil. See Info node `Sentences'."
+regexp describing the end of a sentence, when the value of the variable
+`sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
:type 'boolean
:group 'fill)
without a period.
This value is used by the function `sentence-end' to construct the
-regexp describing the end of a sentence, in case when the value of
-the variable `sentence-end' is nil. See Info node `Sentences'."
+regexp describing the end of a sentence, when the value of the variable
+`sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
:type 'boolean
:group 'fill)
(defcustom sentence-end-without-space
"\e$B!#!%!)!*\e$A!##.#?#!\e$(0!$!%!)!*\e$(G!$!%!)!*\e(B"
- "*String containing characters that end sentence without following spaces.
+ "*String of characters that end sentence without following spaces.
This value is used by the function `sentence-end' to construct the
-regexp describing the end of a sentence, in case when the value of
-the variable `sentence-end' is nil. See Info node `Sentences'."
+regexp describing the end of a sentence, when the value of the variable
+`sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
:group 'paragraphs
:type 'string)
that in order to be recognized as the end of a sentence, the
ending period, question mark, or exclamation point must be
followed by two spaces, unless it's inside some sort of quotes or
-parenthesis. See Info node `Sentences'."
+parenthesis. See Info node `(elisp)Standard Regexps'."
(or sentence-end
(concat (if sentence-end-without-period "\\w \\|")
"\\([.?!][]\"'\xd0c9\x5397d)}]*"
(or arg (setq arg 1))
(forward-paragraph (- arg)))
-(defun mark-paragraph (&optional arg)
+(defun mark-paragraph (&optional arg allow-extend)
"Put point at beginning of this paragraph, mark at end.
The paragraph marked is the one that contains point or follows point.
If ARG is negative, point is put at end of this paragraph, mark is put
at beginning of this or a previous paragraph.
-If this command is repeated, it marks the next ARG paragraphs after (or
-before, if arg is negative) the ones already marked."
- (interactive "p")
+Interactively, if this command is repeated
+or (in Transient Mark mode) if the mark is active,
+it marks the next ARG paragraphs after the ones already marked."
+ (interactive "p\np")
(unless arg (setq arg 1))
(when (zerop arg)
(error "Cannot mark zero paragraphs"))
- (cond ((and (eq last-command this-command) (mark t))
+ (cond ((and allow-extend
+ (or (and (eq last-command this-command) (mark t))
+ (and transient-mark-mode mark-active)))
(set-mark
(save-excursion
(goto-char (mark))