;;; paragraphs.el --- paragraph and sentence parsing.
-;; Copyright (C) 1985, 86, 87, 91, 94, 95, 96 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 86, 87, 91, 94, 95, 96, 1997
+;; Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: wp
;;; Code:
-(defvar use-hard-newlines nil
+(defgroup paragraphs nil
+ "Paragraph and sentence parsing."
+ :group 'editing)
+
+(defcustom use-hard-newlines nil
"Non-nil means to distinguish hard and soft newlines.
-See documentation for the `use-hard-newlines' function.")
+See documentation for the `use-hard-newlines' function."
+ :set '(lambda (symbol value) (use-hard-newlines (or value 0)))
+ :group 'paragraphs
+ :type 'boolean)
(make-variable-buffer-local 'use-hard-newlines)
(defun use-hard-newlines (&optional arg insert)
(point) (1+ (point))))))))))))
(setq use-hard-newlines t)))
-(defvar paragraph-start "[ \t\n\f]" "\
+(defcustom paragraph-start "[ \t\n\f]" "\
*Regexp for beginning of a line that starts OR separates paragraphs.
This regexp should match lines that separate paragraphs
and should also match lines that start a paragraph
lines that start paragraphs from lines that separate them.
If the variable `use-hard-newlines' is nonnil, then only lines following a
-hard newline are considered to match.")
+hard newline are considered to match."
+ :group 'paragraphs
+ :type 'regexp)
;; paragraph-start requires a hard newline, but paragraph-separate does not:
;; It is assumed that paragraph-separate is distinctive enough to be believed
;; something very minimal, even including "." (which makes every hard newline
;; start a new paragraph).
-(defvar paragraph-separate "[ \t\f]*$" "\
-*Regexp for beginning of a line that separates paragraphs.
+(defcustom paragraph-separate "[ \t\f]*$"
+ "*Regexp for beginning of a line that separates paragraphs.
If you change this, you may have to change paragraph-start also.
This is matched against the text at the left margin, which is not necessarily
the beginning of the line, so it should not use \"^\" as an anchor. This
ensures that the paragraph functions will work equally within a region of
-text indented by a margin setting.")
+text indented by a margin setting."
+ :group 'paragraphs
+ :type 'regexp)
-(defvar sentence-end (purecopy "[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*") "\
-*Regexp describing the end of a sentence.
+(defcustom sentence-end (purecopy "[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*")
+ "*Regexp describing the end of a sentence.
All paragraph boundaries also end sentences, regardless.
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.")
+unless it's inside some sort of quotes or parenthesis."
+ :group 'paragraphs
+ :type 'regexp)
-(defvar page-delimiter "^\014" "\
-*Regexp describing line-beginnings that separate pages.")
+(defcustom page-delimiter "^\014"
+ "*Regexp describing line-beginnings that separate pages."
+ :group 'paragraphs
+ :type 'regexp)
-(defvar paragraph-ignore-fill-prefix nil "\
-Non-nil means the paragraph commands are not affected by `fill-prefix'.
-This is desirable in modes where blank lines are the paragraph delimiters.")
+(defcustom paragraph-ignore-fill-prefix nil
+ "*Non-nil means the paragraph commands are not affected by `fill-prefix'.
+This is desirable in modes where blank lines are the paragraph delimiters."
+ :group 'paragraphs
+ :type 'boolean)
(defun forward-paragraph (&optional arg)
"Move forward to end of paragraph.
-With arg N, do it N times; negative arg -N means move backward N paragraphs.
+With argument ARG, do it ARG times;
+a negative argument ARG = -N means move backward N paragraphs.
A line which `paragraph-start' matches either separates paragraphs
\(if `paragraph-separate' matches it also) or is the first line of a paragraph.
(equal ?^ (aref paragraph-start 0)))
(substring paragraph-start 1)
paragraph-start))
- (paragraph-separate (if (and (not (equal "" paragraph-start))
+ (paragraph-separate (if (and (not (equal "" paragraph-separate))
(equal ?^ (aref paragraph-separate 0)))
- (substring paragraph-separate 1)
+ (substring paragraph-separate 1)
paragraph-separate))
(paragraph-separate
(if fill-prefix-regexp
(defun backward-paragraph (&optional arg)
"Move backward to start of paragraph.
-With arg N, do it N times; negative arg -N means move forward N paragraphs.
+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