comparison lisp/textmodes/paragraphs.el @ 70270:925aeac78b9e

(sentence-end-without-space): Fix safety predicate. (sentence-end-double-space, sentence-end-without-period) (paragraph-ignore-fill-prefix): Tighten the safety predicate.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 29 Apr 2006 13:59:04 +0000
parents 1fd89e2b70fd
children e3694f1cb928 2ecafc6d5db7
comparison
equal deleted inserted replaced
70269:68e36cf88728 70270:925aeac78b9e
79 (end-of-line) 79 (end-of-line)
80 (unless (eobp) 80 (unless (eobp)
81 (set-hard-newline-properties (point) (1+ (point))))))))))) 81 (set-hard-newline-properties (point) (1+ (point)))))))))))
82 82
83 (defcustom paragraph-start "\f\\|[ \t]*$" "\ 83 (defcustom paragraph-start "\f\\|[ \t]*$" "\
84 *Regexp for beginning of a line that starts OR separates paragraphs. 84 Regexp for beginning of a line that starts OR separates paragraphs.
85 This regexp should match lines that separate paragraphs 85 This regexp should match lines that separate paragraphs
86 and should also match lines that start a paragraph 86 and should also match lines that start a paragraph
87 \(and are part of that paragraph). 87 \(and are part of that paragraph).
88 88
89 This is matched against the text at the left margin, which is not necessarily 89 This is matched against the text at the left margin, which is not necessarily
105 ;; whenever it occurs, while it is reasonable to set paragraph-start to 105 ;; whenever it occurs, while it is reasonable to set paragraph-start to
106 ;; something very minimal, even including "." (which makes every hard newline 106 ;; something very minimal, even including "." (which makes every hard newline
107 ;; start a new paragraph). 107 ;; start a new paragraph).
108 108
109 (defcustom paragraph-separate "[ \t\f]*$" 109 (defcustom paragraph-separate "[ \t\f]*$"
110 "*Regexp for beginning of a line that separates paragraphs. 110 "Regexp for beginning of a line that separates paragraphs.
111 If you change this, you may have to change `paragraph-start' also. 111 If you change this, you may have to change `paragraph-start' also.
112 112
113 This is matched against the text at the left margin, which is not necessarily 113 This is matched against the text at the left margin, which is not necessarily
114 the beginning of the line, so it should not use \"^\" as an anchor. This 114 the beginning of the line, so it should not use \"^\" as an anchor. This
115 ensures that the paragraph functions will work equally within a region of 115 ensures that the paragraph functions will work equally within a region of
117 :group 'paragraphs 117 :group 'paragraphs
118 :type 'regexp) 118 :type 'regexp)
119 ;;;###autoload(put 'paragraph-separate 'safe-local-variable 'stringp) 119 ;;;###autoload(put 'paragraph-separate 'safe-local-variable 'stringp)
120 120
121 (defcustom sentence-end-double-space t 121 (defcustom sentence-end-double-space t
122 "*Non-nil means a single space does not end a sentence. 122 "Non-nil means a single space does not end a sentence.
123 This is relevant for filling. See also `sentence-end-without-period' 123 This is relevant for filling. See also `sentence-end-without-period'
124 and `colon-double-space'. 124 and `colon-double-space'.
125 125
126 This value is used by the function `sentence-end' to construct the 126 This value is used by the function `sentence-end' to construct the
127 regexp describing the end of a sentence, when the value of the variable 127 regexp describing the end of a sentence, when the value of the variable
128 `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." 128 `sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
129 :type 'boolean 129 :type 'boolean
130 :group 'fill) 130 :group 'fill)
131 ;;;###autoload(put 'sentence-end-double-space 'safe-local-variable 'symbolp) 131 ;;;###autoload(put 'sentence-end-double-space 'safe-local-variable 'booleanp)
132 132
133 (defcustom sentence-end-without-period nil 133 (defcustom sentence-end-without-period nil
134 "*Non-nil means a sentence will end without a period. 134 "Non-nil means a sentence will end without a period.
135 For example, a sentence in Thai text ends with double space but 135 For example, a sentence in Thai text ends with double space but
136 without a period. 136 without a period.
137 137
138 This value is used by the function `sentence-end' to construct the 138 This value is used by the function `sentence-end' to construct the
139 regexp describing the end of a sentence, when the value of the variable 139 regexp describing the end of a sentence, when the value of the variable
140 `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." 140 `sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
141 :type 'boolean 141 :type 'boolean
142 :group 'fill) 142 :group 'fill)
143 ;;;###autoload(put 'sentence-end-without-period 'safe-local-variable 'symbolp) 143 ;;;###autoload(put 'sentence-end-without-period 'safe-local-variable 'booleanp)
144 144
145 (defcustom sentence-end-without-space 145 (defcustom sentence-end-without-space
146 "$B!#!%!)!*$A!##.#?#!$(0!$!%!)!*$(G!$!%!)!*(B" 146 "$B!#!%!)!*$A!##.#?#!$(0!$!%!)!*$(G!$!%!)!*(B"
147 "*String of characters that end sentence without following spaces. 147 "String of characters that end sentence without following spaces.
148 148
149 This value is used by the function `sentence-end' to construct the 149 This value is used by the function `sentence-end' to construct the
150 regexp describing the end of a sentence, when the value of the variable 150 regexp describing the end of a sentence, when the value of the variable
151 `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." 151 `sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
152 :group 'paragraphs 152 :group 'paragraphs
153 :type 'string) 153 :type 'string)
154 ;;;###autoload(put 'sentence-end-without-space 'safe-local-variable 'symbolp) 154 ;;;###autoload(put 'sentence-end-without-space 'safe-local-variable 'stringp)
155 155
156 (defcustom sentence-end nil 156 (defcustom sentence-end nil
157 "*Regexp describing the end of a sentence. 157 "Regexp describing the end of a sentence.
158 The value includes the whitespace following the sentence. 158 The value includes the whitespace following the sentence.
159 All paragraph boundaries also end sentences, regardless. 159 All paragraph boundaries also end sentences, regardless.
160 160
161 The value nil means to use the default value defined by the 161 The value nil means to use the default value defined by the
162 function `sentence-end'. You should always use this function 162 function `sentence-end'. You should always use this function
164 :group 'paragraphs 164 :group 'paragraphs
165 :type '(choice regexp (const :tag "Use default value" nil))) 165 :type '(choice regexp (const :tag "Use default value" nil)))
166 ;;;###autoload(put 'sentence-end 'safe-local-variable 'string-or-null-p) 166 ;;;###autoload(put 'sentence-end 'safe-local-variable 'string-or-null-p)
167 167
168 (defcustom sentence-end-base "[.?!][]\"'$B!I$,1r}(B)}]*" 168 (defcustom sentence-end-base "[.?!][]\"'$B!I$,1r}(B)}]*"
169 "*Regexp matching the basic end of a sentence, not including following space." 169 "Regexp matching the basic end of a sentence, not including following space."
170 :group 'paragraphs 170 :group 'paragraphs
171 :type 'string 171 :type 'string
172 :version "22.1") 172 :version "22.1")
173 ;;;###autoload(put 'sentence-end-base 'safe-local-variable 'stringp) 173 ;;;###autoload(put 'sentence-end-base 'safe-local-variable 'stringp)
174 174
193 "\\|[" sentence-end-without-space "]+" 193 "\\|[" sentence-end-without-space "]+"
194 "\\)" 194 "\\)"
195 "[ \t\n]*"))) 195 "[ \t\n]*")))
196 196
197 (defcustom page-delimiter "^\014" 197 (defcustom page-delimiter "^\014"
198 "*Regexp describing line-beginnings that separate pages." 198 "Regexp describing line-beginnings that separate pages."
199 :group 'paragraphs 199 :group 'paragraphs
200 :type 'regexp) 200 :type 'regexp)
201 ;;;###autoload(put 'page-delimiter 'safe-local-variable 'stringp) 201 ;;;###autoload(put 'page-delimiter 'safe-local-variable 'stringp)
202 202
203 (defcustom paragraph-ignore-fill-prefix nil 203 (defcustom paragraph-ignore-fill-prefix nil
204 "*Non-nil means the paragraph commands are not affected by `fill-prefix'. 204 "Non-nil means the paragraph commands are not affected by `fill-prefix'.
205 This is desirable in modes where blank lines are the paragraph delimiters." 205 This is desirable in modes where blank lines are the paragraph delimiters."
206 :group 'paragraphs 206 :group 'paragraphs
207 :type 'boolean) 207 :type 'boolean)
208 ;;;###autoload(put 'paragraph-ignore-fill-prefix 'safe-local-variable 'symbolp) 208 ;;;###autoload(put 'paragraph-ignore-fill-prefix 'safe-local-variable 'booleanp)
209 209
210 (defun forward-paragraph (&optional arg) 210 (defun forward-paragraph (&optional arg)
211 "Move forward to end of paragraph. 211 "Move forward to end of paragraph.
212 With argument ARG, do it ARG times; 212 With argument ARG, do it ARG times;
213 a negative argument ARG = -N means move backward N paragraphs. 213 a negative argument ARG = -N means move backward N paragraphs.