Mercurial > hg > xemacs-beta
comparison lisp/lisp.el @ 4724:7eef89a3d41f
Improve docstrings of defun movement functions.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Fri, 09 Oct 2009 05:10:03 +0900 |
parents | a46d7513a364 |
children | 4bbda1c11a7b |
comparison
equal
deleted
inserted
replaced
4712:a46d7513a364 | 4724:7eef89a3d41f |
---|---|
156 (kill-sexp (- (or arg 1)))) | 156 (kill-sexp (- (or arg 1)))) |
157 | 157 |
158 | 158 |
159 ;; derived stuff from GNU Emacs | 159 ;; derived stuff from GNU Emacs |
160 (defvar beginning-of-defun-function nil | 160 (defvar beginning-of-defun-function nil |
161 "If non-nil, function for `beginning-of-defun-raw' to call. | 161 "If non-nil, this function will be called by `beginning-of-defun-raw'. |
162 This is used to find the beginning of the defun instead of using the | 162 It will be called with one argument, which is a repetition count. |
163 normal recipe (see `beginning-of-defun'). Modes can define this | 163 It provides an alternative algorithm to find the beginning of the current |
164 if defining `defun-prompt-regexp' is not sufficient to handle the mode's | 164 defun instead of using the standard one implemented by `beginning-of-defun'. |
165 needs.") | 165 See also `defun-prompt-regexp' for minor tweaks.") |
166 (make-variable-buffer-local 'beginning-of-defun-function) | 166 (make-variable-buffer-local 'beginning-of-defun-function) |
167 | 167 |
168 (defvar end-of-defun-function nil | 168 (defvar end-of-defun-function nil |
169 "If non-nil, function for `end-of-defun' to call. | 169 "If non-nil, this function will be called by `end-of-defun'. |
170 This is used to find the end of the defun instead of using the normal | 170 It will be called with no arguments. \(Repetition is implemented in |
171 recipe (see `end-of-defun'). Modes can define this if the | 171 `end-of-defun' by calling this function that many times.) |
172 normal method is not appropriate.") | 172 This function provides an alternative algorithm to find the end |
173 of the current defun instead of using the standard one implemented by | |
174 `end-of-defun'. | |
175 ") | |
173 (make-variable-buffer-local 'end-of-defun-function) | 176 (make-variable-buffer-local 'end-of-defun-function) |
174 | 177 |
175 (defun beginning-of-defun (&optional arg) | 178 (defun beginning-of-defun (&optional arg) |
176 "Move backward to the beginning of a defun. | 179 "Move backward to the beginning of the current defun. |
177 With argument, do it that many times. Negative arg -N | 180 With argument, do it that many times. Negative arg -N |
178 means move forward to Nth following beginning of defun. | 181 means move forward to Nth following beginning of defun. |
179 Returns t unless search stops due to beginning or end of buffer. | 182 Returns t unless search stops due to beginning or end of buffer. |
180 | 183 |
181 Normally a defun starts when there is an char with open-parenthesis | 184 In the default implementation provided by `beginning-of-defun-raw', |
182 syntax at the beginning of a line. If `defun-prompt-regexp' is | 185 a defun starts at a char with open-parenthesis syntax at the beginning |
183 non-nil, then a string which matches that regexp may precede the | 186 of a line. If `defun-prompt-regexp' is non-nil, then a string which |
184 open-parenthesis, and point ends up at the beginning of the line." | 187 matches that regexp may precede the open-parenthesis. Alternatively, |
188 if `beginning-of-defun-function' is non-nil, that function is called, | |
189 and none of the default processing is done. | |
190 | |
191 If the beginning of defun function returns t, point moves to the | |
192 beginning of the line containing the beginning of defun." | |
185 ;; XEmacs change (for zmacs regions) | 193 ;; XEmacs change (for zmacs regions) |
186 (interactive "_p") | 194 (interactive "_p") |
187 (and (beginning-of-defun-raw arg) | 195 (and (beginning-of-defun-raw arg) |
188 (progn (beginning-of-line) t))) | 196 (progn (beginning-of-line) t))) |
189 | 197 |
212 | 220 |
213 (defun end-of-defun (&optional arg) | 221 (defun end-of-defun (&optional arg) |
214 "Move forward to next end of defun. With argument, do it that many times. | 222 "Move forward to next end of defun. With argument, do it that many times. |
215 Negative argument -N means move back to Nth preceding end of defun. | 223 Negative argument -N means move back to Nth preceding end of defun. |
216 | 224 |
217 An end of a defun occurs right after the close-parenthesis that matches | 225 In the default implementation, the end of a defun is the end of the |
218 the open-parenthesis that starts a defun; see `beginning-of-defun'." | 226 s-expression started at the character identified by `beginning-of-defun'. |
227 | |
228 If `end-of-defun-function' is non-nil, none of the default processing is | |
229 done. For a repetition count greater than 1, `end-of-defun-function' is | |
230 called that many times. If the repetition count is less than 1, nothing | |
231 is done. \(This is a bug.)" | |
219 ;; XEmacs change (for zmacs regions) | 232 ;; XEmacs change (for zmacs regions) |
220 (interactive "_p") | 233 (interactive "_p") |
221 (if (or (null arg) (= arg 0)) (setq arg 1)) | 234 (if (or (null arg) (= arg 0)) (setq arg 1)) |
222 (if end-of-defun-function | 235 (if end-of-defun-function |
223 (if (> arg 0) | 236 (if (> arg 0) |