bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50508: 27.2; find-function ignore find-function-source-path


From: Lars Ingebrigtsen
Subject: bug#50508: 27.2; find-function ignore find-function-source-path
Date: Sat, 11 Sep 2021 15:31:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]