all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Thierry Volpiatto <thievol@posteo.net>
Cc: 50508@debbugs.gnu.org
Subject: bug#50508: 27.2; find-function ignore find-function-source-path
Date: Sat, 11 Sep 2021 15:31:48 +0200	[thread overview]
Message-ID: <87ee9vkzln.fsf@gnus.org> (raw)
In-Reply-To: <87zgskmxhe.fsf@posteo.net> (Thierry Volpiatto's message of "Fri,  10 Sep 2021 12:13:49 +0000")

Thierry Volpiatto <thievol@posteo.net> writes:

> according its docstring, find-function should honor
> find-function-source-path but it doesn't, here from emacs -Q:
>
>     (let ((find-function-source-path '("/home/thierry/tmp/emacs/lisp/emacs-lisp/")))
>       (find-function 'find-function))
> Jump to the definition of find-function in /usr/local/share/.../find-func.el.gz
>
> However find-library-name is using it:
>
>     (let ((find-function-source-path '("/home/thierry/tmp/emacs/lisp/emacs-lisp/")))
>       (find-library-name "find-func"))
> ;; => "/home/thierry/tmp/emacs/lisp/emacs-lisp/find-func.el"
>
> So either it is a bug or I misunderstand something.

I'm not a sure whether it's a bug or not, but the functions certainly
don't work the way they're documented.  There's a lot of functions
involved here, but it looks like this has been broken for many years
(since before Emacs 25.1, at least).

Currently the implementation basically just looks a load-history, so
this is wrong:

---
The library where FUNCTION is defined is searched for in
‘find-function-source-path’, if non-nil, otherwise in ‘load-path’.
---

That is, it doesn't do any searching at all, as far as I can tell.

`find-library-name', on the other hand, does search.

There's several different issues here.

1) If the function is defined, say, with `M-: (defun foo ())'
then `find-function-library' will return nil (which is correct), which
means that `find-function-search-for-symbol' will give up immediately.
But it's hard to say what it should do otherwise -- look in all .el
files in the load path to find it?  This is what it's documented to do:

---
If the file where FUNCTION is defined is not known, then it is
searched for in `find-function-source-path' if non-nil, otherwise
in `load-path'."
---

This functionality was apparently lost in this change

commit 2cd6a032aa501a3964be9d222e65bb44ba9960f7
Author:     Richard M. Stallman <rms@gnu.org>
AuthorDate: Mon Jun 29 17:23:25 1998 +0000

or...  well, I'm not sure, but it stopped doing regexp searches through
all .el files at some point, and instead just uses the load history.

I think fixing this isn't...  useful.

2) If the function was defined in a .el file (as this bug report
describes), then Emacs knows the name of the library.  But it doesn't
then use `find-library-name' to locate the library, but just uses
load-history.  Fixing this is pretty easy -- just use
`find-library-name' and use that instead of the value from
`load-history'.

Anybody else have any insights here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2021-09-11 13:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 12:13 bug#50508: 27.2; find-function ignore find-function-source-path Thierry Volpiatto
2021-09-11 13:31 ` Lars Ingebrigtsen [this message]
2021-09-11 16:29   ` Thierry Volpiatto
2021-09-13  7:48     ` Lars Ingebrigtsen
2021-09-13 15:24       ` Thierry Volpiatto
2021-09-14 11:45         ` Lars Ingebrigtsen
2021-09-14 17:24           ` Thierry Volpiatto

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=87ee9vkzln.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=50508@debbugs.gnu.org \
    --cc=thievol@posteo.net \
    /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.