Index: lisp.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp.el,v retrieving revision 1.76 diff -u -r1.76 lisp.el --- lisp.el 7 Dec 2006 04:47:47 -0000 1.76 +++ lisp.el 15 Dec 2006 06:22:10 -0000 @@ -208,17 +208,18 @@ If variable `beginning-of-defun-function' is non-nil, its value is called as a function to find the defun's beginning." - (interactive "p") ; change this to "P", maybe, if we ever come to pass ARG - ; to beginning-of-defun-function. - (unless arg (setq arg 1)) ; The call might not be interactive. + (interactive "p") + (setq arg (or arg 1)) (cond - (beginning-of-defun-function - (if (> arg 0) - (dotimes (i arg) - (funcall beginning-of-defun-function)) - ;; Better not call end-of-defun-function directly, in case - ;; it's not defined. - (end-of-defun (- arg)))) + (beginning-of-defun-function + (let ((bodf beginning-of-defun-function) + beginning-of-defun-function) + (if (> (setq arg (or arg 1)) 0) + (dotimes (i arg) + (funcall bodf)) + ;; Better not call end-of-defun-function directly, in case + ;; it's not defined. + (end-of-defun (- arg))))) ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start) (and (< arg 0) (not (eobp)) (forward-char 1)) @@ -297,12 +298,14 @@ (push-mark)) (if (or (null arg) (= arg 0)) (setq arg 1)) (if end-of-defun-function - (if (> arg 0) - (dotimes (i arg) - (funcall end-of-defun-function)) - ;; Better not call beginning-of-defun-function - ;; directly, in case it's not defined. - (beginning-of-defun (- arg))) + (let ((eodf end-of-defun-function) + end-of-defun-function) + (if (> arg 0) + (dotimes (i arg) + (funcall eodf)) + ;; Better not call beginning-of-defun-function + ;; directly, in case it's not defined. + (beginning-of-defun (- arg)))) (let ((first t)) (while (and (> arg 0) (< (point) (point-max))) (let ((pos (point)))