diff options
| author | Stefan Monnier | 2002-05-16 20:11:23 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-05-16 20:11:23 +0000 |
| commit | 54cabb1b6551bdc6cbefb086cd11f096c625f585 (patch) | |
| tree | 80ff28fc5cc7d4aab9a56c5c9e70fa52ad899f84 | |
| parent | 883e7198fbca465171c0ba10e4a12326fa80500d (diff) | |
| download | emacs-54cabb1b6551bdc6cbefb086cd11f096c625f585.tar.gz emacs-54cabb1b6551bdc6cbefb086cd11f096c625f585.zip | |
(find-function-search-for-symbol): Find funs defined with defun-cvs-mode.
(find-function-space-re): New const. Skips comments as well.
(find-function-regexp, find-variable-regexp): Use it.
| -rw-r--r-- | lisp/emacs-lisp/find-func.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 82f3ee2116d..93c1f279e10 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el | |||
| @@ -54,14 +54,17 @@ | |||
| 54 | ;; :prefix "find-function" | 54 | ;; :prefix "find-function" |
| 55 | :group 'lisp) | 55 | :group 'lisp) |
| 56 | 56 | ||
| 57 | (defconst find-function-space-re "\\(?:\\s-\\|\n\\|;.*\n\\)+") | ||
| 58 | |||
| 57 | (defcustom find-function-regexp | 59 | (defcustom find-function-regexp |
| 58 | ;; Match things like (defun foo ...), (defmacro foo ...), | 60 | ;; Match things like (defun foo ...), (defmacro foo ...), |
| 59 | ;; (define-skeleton foo ...), (define-generic-mode 'foo ...), | 61 | ;; (define-skeleton foo ...), (define-generic-mode 'foo ...), |
| 60 | ;; (define-derived-mode foo ...), (define-minor-mode foo) | 62 | ;; (define-derived-mode foo ...), (define-minor-mode foo) |
| 61 | "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\ | 63 | (concat |
| 64 | "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\ | ||
| 62 | \[^cgv\W]\\w+\\*?\\)\\|define-minor-mode\ | 65 | \[^cgv\W]\\w+\\*?\\)\\|define-minor-mode\ |
| 63 | \\|easy-mmode-define-global-mode\\)\\(\\s-\\|\n\\)+\\('\\|\(quote \\)?\ | 66 | \\|easy-mmode-define-global-mode\\)" find-function-space-re |
| 64 | %s\\(\\s-\\|$\\|\(\\|\)\\)" | 67 | "\\('\\|\(quote \\)?%s\\(\\s-\\|$\\|\(\\|\)\\)") |
| 65 | "The regexp used by `find-function' to search for a function definition. | 68 | "The regexp used by `find-function' to search for a function definition. |
| 66 | Note it must contain a `%s' at the place where `format' | 69 | Note it must contain a `%s' at the place where `format' |
| 67 | should insert the function name. The default value avoids `defconst', | 70 | should insert the function name. The default value avoids `defconst', |
| @@ -73,7 +76,7 @@ Please send improvements and fixes to the maintainer." | |||
| 73 | :version "21.1") | 76 | :version "21.1") |
| 74 | 77 | ||
| 75 | (defcustom find-variable-regexp | 78 | (defcustom find-variable-regexp |
| 76 | "^\\s-*(def[^umag]\\(\\w\\|\\s_\\)+\\*?\\s-+%s\\(\\s-\\|$\\)" | 79 | (concat"^\\s-*(def[^umag]\\(\\w\\|\\s_\\)+\\*?" find-function-space-re "%s\\(\\s-\\|$\\)") |
| 77 | "The regexp used by `find-variable' to search for a variable definition. | 80 | "The regexp used by `find-variable' to search for a variable definition. |
| 78 | It should match right up to the variable name. The default value | 81 | It should match right up to the variable name. The default value |
| 79 | avoids `defun', `defmacro', `defalias', `defadvice', `defgroup'. | 82 | avoids `defun', `defmacro', `defalias', `defadvice', `defgroup'. |
| @@ -145,7 +148,7 @@ If VARIABLE-P is nil, `find-function-regexp' is used, otherwise | |||
| 145 | (goto-char (point-min)) | 148 | (goto-char (point-min)) |
| 146 | (if (or (re-search-forward regexp nil t) | 149 | (if (or (re-search-forward regexp nil t) |
| 147 | (re-search-forward | 150 | (re-search-forward |
| 148 | (concat "^([^ ]+\\(\\s-\\|\n\\)+" | 151 | (concat "^([^ ]+" find-function-space-re "['(]" |
| 149 | (regexp-quote (symbol-name symbol)) | 152 | (regexp-quote (symbol-name symbol)) |
| 150 | "\\>") | 153 | "\\>") |
| 151 | nil t)) | 154 | nil t)) |