aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-03-18 02:21:52 +0000
committerKarl Heuer1994-03-18 02:21:52 +0000
commitafa995e19e7c62f03b91b77872afc2d7f899e0f7 (patch)
treeda84bc8ca07fea3d89a170a1bd8b3a4fa3c70def
parent37f31acf876064714d3498ae7436174f0b4c83c5 (diff)
downloademacs-afa995e19e7c62f03b91b77872afc2d7f899e0f7.tar.gz
emacs-afa995e19e7c62f03b91b77872afc2d7f899e0f7.zip
(beginning-of-defun-raw): New function.
(end-of-defun): Handle defun-prompt-regexp correctly.
-rw-r--r--lisp/emacs-lisp/lisp.el22
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index ebe0885c769..3156ff39b35 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -135,7 +135,15 @@ Returns t unless search stops due to beginning or end of buffer.
135Normally a defun starts when there is an char with open-parenthesis 135Normally a defun starts when there is an char with open-parenthesis
136syntax at the beginning of a line. If `defun-prompt-regexp' is 136syntax at the beginning of a line. If `defun-prompt-regexp' is
137non-nil, then a string which matches that regexp may precede the 137non-nil, then a string which matches that regexp may precede the
138open-parenthesis." 138open-parenthesis, and point ends up at the beginning of the line."
139 (interactive "p")
140 (and (beginning-of-defun-raw arg)
141 (progn (beginning-of-line) t)))
142
143(defun beginning-of-defun-raw (&optional arg)
144 "Move point to the character that starts a defun.
145This is identical to beginning-of-defun, except that point does not move
146to the beginning of the line when `defun-prompt-regexp' is non-nil."
139 (interactive "p") 147 (interactive "p")
140 (and arg (< arg 0) (forward-char 1)) 148 (and arg (< arg 0) (forward-char 1))
141 (and (re-search-backward (if defun-prompt-regexp 149 (and (re-search-backward (if defun-prompt-regexp
@@ -143,7 +151,7 @@ open-parenthesis."
143 "\\(" defun-prompt-regexp "\\)\\s(") 151 "\\(" defun-prompt-regexp "\\)\\s(")
144 "^\\s(") 152 "^\\s(")
145 nil 'move (or arg 1)) 153 nil 'move (or arg 1))
146 (progn (beginning-of-line) t))) 154 (progn (goto-char (1- (match-end 0)))) t))
147 155
148(defun buffer-end (arg) 156(defun buffer-end (arg)
149 (if (> arg 0) (point-max) (point-min))) 157 (if (> arg 0) (point-max) (point-min)))
@@ -162,11 +170,11 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'."
162 (while (progn 170 (while (progn
163 (if (and first 171 (if (and first
164 (progn 172 (progn
165 (forward-char 1) 173 (end-of-line 1)
166 (beginning-of-defun 1))) 174 (beginning-of-defun-raw 1)))
167 nil 175 nil
168 (or (bobp) (forward-char -1)) 176 (or (bobp) (forward-char -1))
169 (beginning-of-defun -1)) 177 (beginning-of-defun-raw -1))
170 (setq first nil) 178 (setq first nil)
171 (forward-list 1) 179 (forward-list 1)
172 (skip-chars-forward " \t") 180 (skip-chars-forward " \t")
@@ -176,11 +184,11 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'."
176 (setq arg (1- arg))) 184 (setq arg (1- arg)))
177 (while (< arg 0) 185 (while (< arg 0)
178 (let ((pos (point))) 186 (let ((pos (point)))
179 (beginning-of-defun 1) 187 (beginning-of-defun-raw 1)
180 (forward-sexp 1) 188 (forward-sexp 1)
181 (forward-line 1) 189 (forward-line 1)
182 (if (>= (point) pos) 190 (if (>= (point) pos)
183 (if (beginning-of-defun 2) 191 (if (beginning-of-defun-raw 2)
184 (progn 192 (progn
185 (forward-list 1) 193 (forward-list 1)
186 (skip-chars-forward " \t") 194 (skip-chars-forward " \t")