From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#50508: 27.2; find-function ignore find-function-source-path Date: Sat, 11 Sep 2021 15:31:48 +0200 Message-ID: <87ee9vkzln.fsf@gnus.org> References: <87zgskmxhe.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17896"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 50508@debbugs.gnu.org To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 11 15:32:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mP375-0004Rh-9L for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Sep 2021 15:32:11 +0200 Original-Received: from localhost ([::1]:48548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mP373-0001WQ-Em for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Sep 2021 09:32:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mP36w-0001W1-HX for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 09:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56460) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mP36w-0003kH-91 for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 09:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mP36w-0005rN-5i for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 09:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Sep 2021 13:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50508 X-GNU-PR-Package: emacs Original-Received: via spool by 50508-submit@debbugs.gnu.org id=B50508.163136712022517 (code B ref 50508); Sat, 11 Sep 2021 13:32:02 +0000 Original-Received: (at 50508) by debbugs.gnu.org; 11 Sep 2021 13:32:00 +0000 Original-Received: from localhost ([127.0.0.1]:39773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP36t-0005r7-LH for submit@debbugs.gnu.org; Sat, 11 Sep 2021 09:31:59 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:37084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP36r-0005qj-Hx for 50508@debbugs.gnu.org; Sat, 11 Sep 2021 09:31:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iHHoR4mwTv1cYNZ5X0ZcbbLjAjC34Dw4G4DLTytZ5Ak=; b=G3uqCsHMhX3XgzHubETGtyDqx2 M+47gEq5y3dxAIRtXMk3g46Z8TwEY5vlaJkgSdTFyI1GLxbchRy3g4AsevjmeeXHXmKVGgstpkK8r 7lDC0Mo4Bh4rsfv+VvL3yCx4l/n8A/u/nx2r0A+LaEVwWjlwx7dp4gRLhJCYur/DWkMY=; Original-Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mP36i-0000XV-Fv; Sat, 11 Sep 2021 15:31:51 +0200 In-Reply-To: <87zgskmxhe.fsf@posteo.net> (Thierry Volpiatto's message of "Fri, 10 Sep 2021 12:13:49 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214077 Archived-At: Thierry Volpiatto 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/emac= s-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/emac= s-lisp/"))) > (find-library-name "find-func")) > ;; =3D> "/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 =E2=80=98find-function-source-path=E2=80=99, if non-nil, otherwise in =E2= =80=98load-path=E2=80=99. --- 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 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? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no