aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2007-11-22 22:12:22 +0000
committerStefan Monnier2007-11-22 22:12:22 +0000
commit50bfa18a09a1d1257116d0e391da864e79ebd669 (patch)
tree09dbd01f6af7b715f5743f98f11afd89bbbd911c /lisp
parenta352dec11f7d1f63194258a16231906c96b01a1c (diff)
downloademacs-50bfa18a09a1d1257116d0e391da864e79ebd669.tar.gz
emacs-50bfa18a09a1d1257116d0e391da864e79ebd669.zip
(beginning-of-defun-raw): Pass `arg' down to beginning-of-defun-function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/lisp.el29
2 files changed, 25 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 43ef38d73cd..393f7791e2c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-11-22 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/lisp.el (beginning-of-defun-raw): Pass `arg' down to
4 beginning-of-defun-function.
5
12007-11-22 Reiner Steib <Reiner.Steib@gmx.de> 62007-11-22 Reiner Steib <Reiner.Steib@gmx.de>
2 7
3 * mail/hashcash.el: Move from ../gnus. Add hashcash payments to email. 8 * mail/hashcash.el: Move from ../gnus. Add hashcash payments to email.
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 788be284cda..e607245d0ed 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -175,9 +175,10 @@ normal recipe (see `beginning-of-defun'). Major modes can define this
175if defining `defun-prompt-regexp' is not sufficient to handle the mode's 175if defining `defun-prompt-regexp' is not sufficient to handle the mode's
176needs. 176needs.
177 177
178The function (of no args) should go to the line on which the current 178The function takes the same argument as `beginning-of-defun' and should
179defun starts, and return non-nil, or should return nil if it can't 179behave similarly, returning non-nil if it found the beginning of a defun.
180find the beginning.") 180Ideally it should move to a point right before an open-paren which encloses
181the body of the defun.")
181 182
182(defun beginning-of-defun (&optional arg) 183(defun beginning-of-defun (&optional arg)
183 "Move backward to the beginning of a defun. 184 "Move backward to the beginning of a defun.
@@ -218,12 +219,22 @@ is called as a function to find the defun's beginning."
218 (unless arg (setq arg 1)) 219 (unless arg (setq arg 1))
219 (cond 220 (cond
220 (beginning-of-defun-function 221 (beginning-of-defun-function
221 (if (> arg 0) 222 (condition-case nil
222 (dotimes (i arg) 223 (funcall beginning-of-defun-function arg)
223 (funcall beginning-of-defun-function)) 224 ;; We used to define beginning-of-defun-function as taking no argument
224 ;; Better not call end-of-defun-function directly, in case 225 ;; but that makes it impossible to implement correct forward motion:
225 ;; it's not defined. 226 ;; we used to use end-of-defun for that, but it's not supposed to do
226 (end-of-defun (- arg)))) 227 ;; the same thing (it moves to the end of a defun not to the beginning
228 ;; of the next).
229 ;; In case the beginning-of-defun-function uses the old calling
230 ;; convention, fallback on the old implementation.
231 (wrong-number-of-arguments
232 (if (> arg 0)
233 (dotimes (i arg)
234 (funcall beginning-of-defun-function))
235 ;; Better not call end-of-defun-function directly, in case
236 ;; it's not defined.
237 (end-of-defun (- arg))))))
227 238
228 ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start) 239 ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start)
229 (and (< arg 0) (not (eobp)) (forward-char 1)) 240 (and (< arg 0) (not (eobp)) (forward-char 1))