summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-02-08 11:10:03 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-02-08 11:10:03 +0100
commitf788bb33e5ac4d4a482e88dedd89e5a64dd1f7d5 (patch)
treea8795bf1d0a10b7478c2cc06fcc91633db2ba88d /lisp/help-fns.el
parenta512940daa046cc529c679942431435175cd6903 (diff)
downloademacs-f788bb33e5ac4d4a482e88dedd89e5a64dd1f7d5.tar.gz
emacs-f788bb33e5ac4d4a482e88dedd89e5a64dd1f7d5.tar.bz2
emacs-f788bb33e5ac4d4a482e88dedd89e5a64dd1f7d5.zip
Extend find-lisp-object-file-name
* lisp/help-fns.el (find-lisp-object-file-name): Add optional parameter to always look in the DOC file (bug#17685).
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el19
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 5da575aa8d1..80d7d5cb028 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -396,7 +396,7 @@ if the variable `help-downcase-arguments' is non-nil."
;; `describe-face' (instead of `describe-simplify-lib-file-name').
;;;###autoload
-(defun find-lisp-object-file-name (object type)
+(defun find-lisp-object-file-name (object type &optional also-c-source)
"Guess the file that defined the Lisp object OBJECT, of type TYPE.
OBJECT should be a symbol associated with a function, variable, or face;
alternatively, it can be a function definition.
@@ -407,8 +407,13 @@ If TYPE is not a symbol, search for a function definition.
The return value is the absolute name of a readable file where OBJECT is
defined. If several such files exist, preference is given to a file
found via `load-path'. The return value can also be `C-source', which
-means that OBJECT is a function or variable defined in C. If no
-suitable file is found, return nil."
+means that OBJECT is a function or variable defined in C, but
+it's currently unknown where. If no suitable file is found,
+return nil.
+
+If ALSO-C-SOURCE is non-nil, instead of returning `C-source',
+this function will attempt to locate the definition of OBJECT in
+the C sources, too."
(let* ((autoloaded (autoloadp type))
(file-name (or (and autoloaded (nth 1 type))
(symbol-file
@@ -445,14 +450,18 @@ suitable file is found, return nil."
(cond
((and (not file-name) (subrp type))
;; A built-in function. The form is from `describe-function-1'.
- (if (get-buffer " *DOC*")
+ (if (or (get-buffer " *DOC*")
+ (and also-c-source
+ (get-buffer-create " *DOC*")))
(help-C-file-name type 'subr)
'C-source))
((and (not file-name) (symbolp object)
(eq type 'defvar)
(integerp (get object 'variable-documentation)))
;; A variable defined in C. The form is from `describe-variable'.
- (if (get-buffer " *DOC*")
+ (if (or (get-buffer " *DOC*")
+ (and also-c-source
+ (get-buffer-create " *DOC*")))
(help-C-file-name object 'var)
'C-source))
((not (stringp file-name))