aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2004-04-29 18:43:32 +0000
committerStefan Monnier2004-04-29 18:43:32 +0000
commit2ea0f8fde524c4998c0ab933cd27ecd50c54e09a (patch)
tree377985ac811df752a60a5228104072084e01c4d0
parentc29dafeb0af5b05fc6fff5e038070f56fdd82cd9 (diff)
downloademacs-2ea0f8fde524c4998c0ab933cd27ecd50c54e09a.tar.gz
emacs-2ea0f8fde524c4998c0ab933cd27ecd50c54e09a.zip
(help-function-def, help-variable-def):
Use the new find-function-search-for-symbol functionality. Allow FILE to be `C-source'.
-rw-r--r--lisp/help-mode.el17
1 files changed, 7 insertions, 10 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 4499f5c48cb..1f1b529c8ef 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -147,14 +147,13 @@ The format is (FUNCTION ARGS...).")
147 :supertype 'help-xref 147 :supertype 'help-xref
148 'help-function (lambda (fun file) 148 'help-function (lambda (fun file)
149 (require 'find-func) 149 (require 'find-func)
150 (when (eq file 'C-source)
151 (setq file
152 (help-C-file-name (indirect-function fun) 'fun)))
150 ;; Don't use find-function-noselect because it follows 153 ;; Don't use find-function-noselect because it follows
151 ;; aliases (which fails for built-in functions). 154 ;; aliases (which fails for built-in functions).
152 (let ((location 155 (let ((location
153 (cond 156 (find-function-search-for-symbol fun nil file)))
154 ((bufferp file) (cons file fun))
155 ((string-match "\\`src/\\(.*\\.c\\)" file)
156 (help-find-C-source fun (match-string 1 file) 'fun))
157 (t (find-function-search-for-symbol fun nil file)))))
158 (pop-to-buffer (car location)) 157 (pop-to-buffer (car location))
159 (goto-char (cdr location)))) 158 (goto-char (cdr location))))
160 'help-echo (purecopy "mouse-2, RET: find function's definition")) 159 'help-echo (purecopy "mouse-2, RET: find function's definition"))
@@ -162,11 +161,9 @@ The format is (FUNCTION ARGS...).")
162(define-button-type 'help-variable-def 161(define-button-type 'help-variable-def
163 :supertype 'help-xref 162 :supertype 'help-xref
164 'help-function (lambda (var &optional file) 163 'help-function (lambda (var &optional file)
165 (let ((location 164 (when (eq file 'C-source)
166 (cond 165 (setq file (help-C-file-name var 'var)))
167 ((string-match "\\`src/\\(.*\\.c\\)" file) 166 (let ((location (find-variable-noselect var file)))
168 (help-find-C-source var (match-string 1 file) 'var))
169 (t (find-variable-noselect var file)))))
170 (pop-to-buffer (car location)) 167 (pop-to-buffer (car location))
171 (goto-char (cdr location)))) 168 (goto-char (cdr location))))
172 'help-echo (purecopy"mouse-2, RET: find variable's definition")) 169 'help-echo (purecopy"mouse-2, RET: find variable's definition"))