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#17467: 24.3; locate-library returning spurious path Date: Tue, 25 Aug 2020 12:39:06 +0200 Message-ID: <87y2m3au2d.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12989"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Alex Kosorukoff , 17467 <17467@debbugs.gnu.org> To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 25 12:41:57 2020 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 1kAWOr-0003GY-87 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 12:41:57 +0200 Original-Received: from localhost ([::1]:40714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAWOq-0007JR-99 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 06:41:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAWN0-0004O0-5g for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 06:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAWMz-0007Ta-QN for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 06:40:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kAWMz-0004WY-O7 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 06:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Aug 2020 10:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17467 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 17467-submit@debbugs.gnu.org id=B17467.159835196017337 (code B ref 17467); Tue, 25 Aug 2020 10:40:01 +0000 Original-Received: (at 17467) by debbugs.gnu.org; 25 Aug 2020 10:39:20 +0000 Original-Received: from localhost ([127.0.0.1]:60417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAWMK-0004VZ-2g for submit@debbugs.gnu.org; Tue, 25 Aug 2020 06:39:20 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:39890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAWMI-0004VM-7i for 17467@debbugs.gnu.org; Tue, 25 Aug 2020 06:39:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: 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=i8cuK2SCVVmpcpWccAsAIzgDpwGX/UXFtdqjXyKDQlQ=; b=l3qljYYnVRR77BwJ+5y5QJkjF6 7AwTVfzRdsgn5wrGnnouaHVyWvFDLbGwxkkL9LLKF6YvtnfK9vYet7qGArOIIP4lAzbNxJaStxvzk MjbkRnHefM1jyMX6CRCqjaYkv8b4IZm5Z2lqUy4PGvfZ7l914WeeeAN/i2KlraQQhDUw=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAWM8-0004Qz-6I; Tue, 25 Aug 2020 12:39:10 +0200 X-Now-Playing: Coil's _The Sound Of Musick_: "Journey To Avebury" In-Reply-To: (Stefan Monnier's message of "Sun, 11 May 2014 22:18:03 -0400") 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:186255 Archived-At: Stefan Monnier writes: > There are a few (~/.emacs being the most obvious), but admittedly, > I think they all share the property of not being searched for in > load-path. So we could probably strengthen the search along the lines > you suggest without (hopefully) breaking existing code with a hack along > the lines of the one below. I've respun the patch for Emacs 28. It sounds reasonable to me, but the use case isn't really compelling. It breaks the so-long-tests-commentary test, which basically does: (finder-commentary "so-long") So I'm not sure whether it makes sense to proceed with this change... diff --git a/lisp/subr.el b/lisp/subr.el index a58a873a33..6eb2f61eb0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2302,10 +2302,15 @@ locate-library string. When run interactively, the argument INTERACTIVE-CALL is t, and the file name is displayed in the echo area." (interactive (list (read-library-name) nil nil t)) - (let ((file (locate-file library - (or path load-path) - (append (unless nosuffix (get-load-suffixes)) - load-file-rep-suffixes)))) + (let* ((suffixes + (nconc (unless nosuffix (get-load-suffixes)) + (when (or (file-name-absolute-p library) + ;; (load "foo.el") should find /bar/foo.el.gz, + ;; but (load "foo") should not find /bar/foo.gz. + (string-match "\\.el\\(\\.[[:alnum:]]+\\)?" + library)) + load-file-rep-suffixes))) + (file (locate-file library (or path load-path) suffixes))) (if interactive-call (if file (message "Library is file %s" (abbreviate-file-name file)) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no