all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: 24697@debbugs.gnu.org
Subject: bug#24697: 25.1; find-lisp-object-file-name may return wrong locations
Date: Sat, 17 Jun 2017 16:26:47 -0600	[thread overview]
Message-ID: <87r2yiz1w8.fsf@lylat> (raw)
In-Reply-To: <87mvi68tg4.fsf@gmail.com> (Alex's message of "Fri, 14 Oct 2016 16:19:23 -0600")

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

Alex <agrambot@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: find-lisp-object.diff --]
[-- Type: text/x-diff, Size: 462 bytes --]

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*")

[-- Attachment #3: Type: text/plain, Size: 476 bytes --]


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'.

  reply	other threads:[~2017-06-17 22:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 22:19 bug#24697: 25.1; find-lisp-object-file-name may return wrong locations Alex
2017-06-17 22:26 ` Alex [this message]
2017-06-18 19:51   ` Dmitry Gutov
2017-06-19  2:59     ` Alex
2017-09-28 21:26       ` Dmitry Gutov
2020-08-11 13:26       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2yiz1w8.fsf@lylat \
    --to=agrambot@gmail.com \
    --cc=24697@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.