diff options
| author | Stefan Monnier | 2007-11-22 22:12:22 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-11-22 22:12:22 +0000 |
| commit | 50bfa18a09a1d1257116d0e391da864e79ebd669 (patch) | |
| tree | 09dbd01f6af7b715f5743f98f11afd89bbbd911c | |
| parent | a352dec11f7d1f63194258a16231906c96b01a1c (diff) | |
| download | emacs-50bfa18a09a1d1257116d0e391da864e79ebd669.tar.gz emacs-50bfa18a09a1d1257116d0e391da864e79ebd669.zip | |
(beginning-of-defun-raw): Pass `arg' down to beginning-of-defun-function.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 29 |
3 files changed, 28 insertions, 9 deletions
| @@ -383,6 +383,9 @@ because they clash with commands provided by dirtrack.el. Use | |||
| 383 | 383 | ||
| 384 | * Lisp Changes in Emacs 23.1 | 384 | * Lisp Changes in Emacs 23.1 |
| 385 | 385 | ||
| 386 | ** `beginning-of-defun-function' now takes one argument, the count | ||
| 387 | given to `beginning-of-defun'. | ||
| 388 | |||
| 386 | +++ | 389 | +++ |
| 387 | ** New function `match-substitute-replacement' returns the result of | 390 | ** New function `match-substitute-replacement' returns the result of |
| 388 | `replace-match' without actually using it in the buffer. | 391 | `replace-match' without actually using it in the buffer. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 43ef38d73cd..393f7791e2c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-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 | |||
| 1 | 2007-11-22 Reiner Steib <Reiner.Steib@gmx.de> | 6 | 2007-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 | |||
| 175 | if defining `defun-prompt-regexp' is not sufficient to handle the mode's | 175 | if defining `defun-prompt-regexp' is not sufficient to handle the mode's |
| 176 | needs. | 176 | needs. |
| 177 | 177 | ||
| 178 | The function (of no args) should go to the line on which the current | 178 | The function takes the same argument as `beginning-of-defun' and should |
| 179 | defun starts, and return non-nil, or should return nil if it can't | 179 | behave similarly, returning non-nil if it found the beginning of a defun. |
| 180 | find the beginning.") | 180 | Ideally it should move to a point right before an open-paren which encloses |
| 181 | the 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)) |