aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2000-01-21 02:44:44 +0000
committerRichard M. Stallman2000-01-21 02:44:44 +0000
commitab22ee535481633703793d8380ecf147b5d32304 (patch)
treef755a3d80d151682465e389e6e0efd06fd13fe71
parentc87dbfd03c6bad52a4ed2254b7b7af880c5a9102 (diff)
downloademacs-ab22ee535481633703793d8380ecf147b5d32304.tar.gz
emacs-ab22ee535481633703793d8380ecf147b5d32304.zip
(beginning-of-defun-function): Variable renamed from beginning-of-defun.
(beginning-of-defun-raw): Use new variable name; doc fix. (beginning-of-defun): Doc fix. (end-of-defun-function): Variable renamed from end-of-defun. (end-of-defun): Use new variable name; doc fix.
-rw-r--r--lisp/emacs-lisp/lisp.el46
1 files changed, 21 insertions, 25 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 5cf4128d38d..9759c41d975 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -133,19 +133,15 @@ Negative arg -N means kill N sexps after the cursor."
133 (interactive "p") 133 (interactive "p")
134 (kill-sexp (- arg))) 134 (kill-sexp (- arg)))
135 135
136(defvar beginning-of-defun nil 136(defvar beginning-of-defun-function nil
137 "If non-nil, function for `beginning-of-defun-raw' to call. 137 "If non-nil, function for `beginning-of-defun-raw' to call.
138This is used to find the beginning of the defun instead of using the 138This is used to find the beginning of the defun instead of using the
139normal recipe described in the doc of function `beginning-of-defun'. 139normal recipe (see `beginning-of-defun'). Major modes can define this
140Major modes can define this if defining `defun-prompt-regexp' is not 140if defining `defun-prompt-regexp' is not sufficient to handle the mode's
141sufficient to use the normal recipe. 141needs.
142 142
143The function should go to the line on which the current \"defun\" 143The function should go to the line on which the current defun starts,
144starts and return non-nil or should return nil if it can't find the 144and return non-nil, or should return nil if it can't find the beginning.")
145beginning.
146
147Buffer-local.")
148(make-variable-buffer-local 'beginning-of-defun)
149 145
150(defun beginning-of-defun (&optional arg) 146(defun beginning-of-defun (&optional arg)
151 "Move backward to the beginning of a defun. 147 "Move backward to the beginning of a defun.
@@ -158,8 +154,8 @@ syntax at the beginning of a line. If `defun-prompt-regexp' is
158non-nil, then a string which matches that regexp may precede the 154non-nil, then a string which matches that regexp may precede the
159open-parenthesis, and point ends up at the beginning of the line. 155open-parenthesis, and point ends up at the beginning of the line.
160 156
161If variable `beginning-of-defun' is non-nil, its value is called as a 157If variable `beginning-of-defun-function' is non-nil, its value
162function to find the defun's beginning." 158is called as a function to find the defun's beginning."
163 (interactive "p") 159 (interactive "p")
164 (and (beginning-of-defun-raw arg) 160 (and (beginning-of-defun-raw arg)
165 (progn (beginning-of-line) t))) 161 (progn (beginning-of-line) t)))
@@ -170,11 +166,11 @@ This is identical to function `beginning-of-defun', except that point
170does not move to the beginning of the line when `defun-prompt-regexp' 166does not move to the beginning of the line when `defun-prompt-regexp'
171is non-nil. 167is non-nil.
172 168
173If variable `beginning-of-defun' is non-nil, its value is called as a 169If variable `beginning-of-defun-function' is non-nil, its value
174function to find the defun's beginning." 170is called as a function to find the defun's beginning."
175 (interactive "p") 171 (interactive "p")
176 (if beginning-of-defun 172 (if beginning-of-defun-function
177 (funcall beginning-of-defun) 173 (funcall beginning-of-defun-function)
178 (and arg (< arg 0) (not (eobp)) (forward-char 1)) 174 (and arg (< arg 0) (not (eobp)) (forward-char 1))
179 (and (re-search-backward (if defun-prompt-regexp 175 (and (re-search-backward (if defun-prompt-regexp
180 (concat "^\\s(\\|" 176 (concat "^\\s(\\|"
@@ -183,14 +179,11 @@ function to find the defun's beginning."
183 nil 'move (or arg 1)) 179 nil 'move (or arg 1))
184 (progn (goto-char (1- (match-end 0)))) t))) 180 (progn (goto-char (1- (match-end 0)))) t)))
185 181
186(defvar end-of-defun nil 182(defvar end-of-defun-function nil
187 "If non-nil, function for function `end-of-defun' to call. 183 "If non-nil, function for function `end-of-defun' to call.
188This is used to find the end of the defun instead of using the normal 184This is used to find the end of the defun instead of using the normal
189recipe described in the doc of function `end-of-defun'. Major modes 185recipe (see `end-of-defun'). Major modes can define this if the
190can define this if the normal recipe is not appropriate. 186normal method is not appropriate.")
191
192Buffer-local.")
193(make-variable-buffer-local 'end-of-defun)
194 187
195(defun buffer-end (arg) 188(defun buffer-end (arg)
196 (if (> arg 0) (point-max) (point-min))) 189 (if (> arg 0) (point-max) (point-min)))
@@ -201,10 +194,13 @@ Negative argument -N means move back to Nth preceding end of defun.
201 194
202An end of a defun occurs right after the close-parenthesis that 195An end of a defun occurs right after the close-parenthesis that
203matches the open-parenthesis that starts a defun; see function 196matches the open-parenthesis that starts a defun; see function
204`beginning-of-defun'." 197`beginning-of-defun'.
198
199If variable `end-of-defun-function' is non-nil, its value
200is called as a function to find the defun's end."
205 (interactive "p") 201 (interactive "p")
206 (if end-of-defun 202 (if end-of-defun-function
207 (funcall end-of-defun) 203 (funcall end-of-defun-function)
208 (if (or (null arg) (= arg 0)) (setq arg 1)) 204 (if (or (null arg) (= arg 0)) (setq arg 1))
209 (let ((first t)) 205 (let ((first t))
210 (while (and (> arg 0) (< (point) (point-max))) 206 (while (and (> arg 0) (< (point) (point-max)))