From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Alex Kosorukoff <alex@3form.com>, 17467 <17467@debbugs.gnu.org>
Subject: bug#17467: 24.3; locate-library returning spurious path
Date: Tue, 25 Aug 2020 12:39:06 +0200 [thread overview]
Message-ID: <87y2m3au2d.fsf@gnus.org> (raw)
In-Reply-To: <jwv4n0v4ut9.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Sun, 11 May 2014 22:18:03 -0400")
Stefan Monnier <monnier@IRO.UMontreal.CA> 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
next prev parent reply other threads:[~2020-08-25 10:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-11 16:06 bug#17467: 24.3; locate-library returning spurious path Alex Kosorukoff
2014-05-11 17:03 ` Eli Zaretskii
2014-05-11 17:38 ` Alex Kosorukoff
2014-05-11 17:46 ` Eli Zaretskii
2014-05-11 17:53 ` Alex Kosorukoff
2014-05-11 18:10 ` Eli Zaretskii
2014-05-11 18:55 ` Alex Kosorukoff
2014-05-11 22:55 ` Stefan Monnier
2014-05-12 0:41 ` Alex Kosorukoff
2014-05-11 17:37 ` Glenn Morris
2014-05-11 17:43 ` Alex Kosorukoff
2014-05-11 19:50 ` Stefan Monnier
2014-05-11 20:45 ` Alex Kosorukoff
2014-05-11 21:00 ` Alex Kosorukoff
2014-05-11 21:19 ` Glenn Morris
2014-05-11 22:31 ` Alex Kosorukoff
2014-05-11 21:56 ` Stefan Monnier
2014-05-12 0:20 ` Alex Kosorukoff
2014-05-12 0:32 ` Glenn Morris
2014-05-12 1:35 ` Alex Kosorukoff
2014-05-12 2:02 ` Alex Kosorukoff
2014-05-12 2:18 ` Stefan Monnier
2014-05-12 4:36 ` Alex Kosorukoff
2014-05-12 6:39 ` Stefan Monnier
2014-05-12 17:46 ` Alex Kosorukoff
2020-08-25 10:39 ` Lars Ingebrigtsen [this message]
2020-08-25 14:22 ` Stefan Monnier
2020-08-25 14:25 ` Lars Ingebrigtsen
2020-10-13 1:41 ` Lars Ingebrigtsen
2014-05-15 19:39 ` Stefan Monnier
2014-05-15 23:57 ` Alex Kosorukoff
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=87y2m3au2d.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=17467@debbugs.gnu.org \
--cc=alex@3form.com \
--cc=monnier@IRO.UMontreal.CA \
/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.