GNU bug report logs -
#24697
25.1; find-lisp-object-file-name may return wrong locations
Previous Next
Reported by: Alex <agrambot <at> gmail.com>
Date: Fri, 14 Oct 2016 22:20:02 UTC
Severity: normal
Tags: fixed, patch
Found in version 25.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Alex <agrambot <at> gmail.com> writes:
> #+BEGIN_SRC elisp
> (defface tab-width
> '((t :foreground "red"))
> "A face with the same name as a variable.")
>
>
> (find-lisp-object-file-name 'tab-width 'defface)
> #+END_SRC
>
>
> The above results in the symbol 'C-source'. The result should be nil as
> the 'tab-width' face was evaluated in *scratch*.
>
> Putting the above definition into an actual file and using `load-file'
> does return the proper source location.
>
> #+BEGIN_SRC elisp
> (find-lisp-object-file-name 'mapatoms 1)
> #+END_SRC
>
>
> This should return 'C-source' but instead it returns nil.
>
> #+BEGIN_SRC elisp
> (find-lisp-object-file-name 'tab-width 1)
> #+END_SRC
>
> This should return nil but instead it returns 'C-source'.
The first and last of these are fixed by the following diff.
[find-lisp-object.diff (text/x-diff, inline)]
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 2c635ffa50..bcf33131fa 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -319,6 +319,7 @@ find-lisp-object-file-name
(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*")
[Message part 3 (text/plain, inline)]
The second is a bit odder. For some reason, find-lisp-object-file-name
searches for an internal function definition using TYPE instead of
OBJECT. I would have expected it to use OBJECT like the rest of the
tests do. I see no reason for the current behaviour.
Either the documentation should be changed to clearly indicate the
current behaviour, or the function should be changed so that OBJECTs for
which (subrp (symbol-function OBJECT)) returns t should return
'C-source'.
This bug report was last modified 4 years and 282 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.