Mercurial > emacs
changeset 6397:70bf65b6aae9
(beginning-of-defun-raw): New function.
(end-of-defun): Handle defun-prompt-regexp correctly.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 18 Mar 1994 02:21:52 +0000 |
parents | 1740ec160ff8 |
children | f0575c116207 |
files | lisp/emacs-lisp/lisp.el |
diffstat | 1 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp.el Fri Mar 18 01:47:28 1994 +0000 +++ b/lisp/emacs-lisp/lisp.el Fri Mar 18 02:21:52 1994 +0000 @@ -135,7 +135,15 @@ Normally a defun starts when there is an char with open-parenthesis syntax at the beginning of a line. If `defun-prompt-regexp' is non-nil, then a string which matches that regexp may precede the -open-parenthesis." +open-parenthesis, and point ends up at the beginning of the line." + (interactive "p") + (and (beginning-of-defun-raw arg) + (progn (beginning-of-line) t))) + +(defun beginning-of-defun-raw (&optional arg) + "Move point to the character that starts a defun. +This is identical to beginning-of-defun, except that point does not move +to the beginning of the line when `defun-prompt-regexp' is non-nil." (interactive "p") (and arg (< arg 0) (forward-char 1)) (and (re-search-backward (if defun-prompt-regexp @@ -143,7 +151,7 @@ "\\(" defun-prompt-regexp "\\)\\s(") "^\\s(") nil 'move (or arg 1)) - (progn (beginning-of-line) t))) + (progn (goto-char (1- (match-end 0)))) t)) (defun buffer-end (arg) (if (> arg 0) (point-max) (point-min))) @@ -162,11 +170,11 @@ (while (progn (if (and first (progn - (forward-char 1) - (beginning-of-defun 1))) + (end-of-line 1) + (beginning-of-defun-raw 1))) nil (or (bobp) (forward-char -1)) - (beginning-of-defun -1)) + (beginning-of-defun-raw -1)) (setq first nil) (forward-list 1) (skip-chars-forward " \t") @@ -176,11 +184,11 @@ (setq arg (1- arg))) (while (< arg 0) (let ((pos (point))) - (beginning-of-defun 1) + (beginning-of-defun-raw 1) (forward-sexp 1) (forward-line 1) (if (>= (point) pos) - (if (beginning-of-defun 2) + (if (beginning-of-defun-raw 2) (progn (forward-list 1) (skip-chars-forward " \t")