diff options
author | Miles Bader <miles@gnu.org> | 2006-11-21 08:56:38 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2006-11-21 08:56:38 +0000 |
commit | eeb7eaa88482114822730380196f4e7a3c0870dd (patch) | |
tree | e8c3861b628ad53c6b8f158b74d1be8bd8590aeb /lisp/emacs-lisp | |
parent | b15d6f4265b10fbc413caca03246feff9c87d53e (diff) | |
parent | a98d0b8e8948293de119c4cdd7a8c79318ad82fa (diff) | |
download | emacs-eeb7eaa88482114822730380196f4e7a3c0870dd.tar.gz |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 505-522)
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: etc/TUTORIAL.cn: Updated.
- Merge from erc--emacs--22
* gnus--rel--5.10 (patch 164-167)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-137
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp.el | 64 | ||||
-rw-r--r-- | lisp/emacs-lisp/re-builder.el | 1 | ||||
-rw-r--r-- | lisp/emacs-lisp/regexp-opt.el | 2 |
3 files changed, 55 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 29c70f8c344..6bc7da7ba28 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -208,22 +208,64 @@ is non-nil. If variable `beginning-of-defun-function' is non-nil, its value is called as a function to find the defun's beginning." - (interactive "p") - (if beginning-of-defun-function - (if (> (setq arg (or arg 1)) 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))) - (and arg (< arg 0) (not (eobp)) (forward-char 1)) + (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. + (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)))) + + ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start) + (and (< arg 0) (not (eobp)) (forward-char 1)) (and (re-search-backward (if defun-prompt-regexp (concat (if open-paren-in-column-0-is-defun-start "^\\s(\\|" "") "\\(?:" defun-prompt-regexp "\\)\\s(") "^\\s(") - nil 'move (or arg 1)) - (progn (goto-char (1- (match-end 0)))) t))) + nil 'move arg) + (progn (goto-char (1- (match-end 0)))) t)) + + (t + ;; Column 0 has no significance - so scan forward from BOB to see how + ;; nested point is, then carry on from there. + (let* ((floor (point-min)) + (ceiling (point-max)) + (pps-state (let (syntax-begin-function + font-lock-beginning-of-syntax-function) + (syntax-ppss))) + (nesting-depth (nth 0 pps-state))) + (save-restriction + (widen) + ;; Get outside of any string or comment. + (if (nth 8 pps-state) + (goto-char (nth 8 pps-state))) + + (cond + ((> arg 0) + (when (> nesting-depth 0) + (up-list (- nesting-depth)) + (setq arg (1- arg))) + ;; We're now outside of any defun. + (backward-list arg) + (if (< (point) floor) (goto-char floor))) + + ((< arg 0) + (cond + ((> nesting-depth 0) + (up-list nesting-depth) + (setq arg (1+ arg))) + ((not (looking-at "\\s(")) + ;; We're between defuns, and not at the start of one. + (setq arg (1+ arg)))) + (forward-list (- arg)) + (down-list) + (backward-char) + (if (> (point) ceiling) (goto-char ceiling))))))))) (defvar end-of-defun-function nil "If non-nil, function for function `end-of-defun' to call. diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index 5dc67e4ac21..cae4be8addd 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -253,6 +253,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.") (kill-all-local-variables) (setq major-mode 'reb-mode mode-name "RE Builder") + (set (make-local-variable 'blink-matching-paren) nil) (use-local-map reb-mode-map) (reb-mode-common) (run-mode-hooks 'reb-mode-hook)) diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index c2e13be20d8..ab242af3ac3 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -88,7 +88,7 @@ ;;;###autoload (defun regexp-opt (strings &optional paren) - "Return a regexp to match a string in STRINGS. + "Return a regexp to match a string in the list STRINGS. Each string should be unique in STRINGS and should not contain any regexps, quoted or not. If optional PAREN is non-nil, ensure that the returned regexp is enclosed by at least one regexp grouping construct. |