GNU bug report logs -
#17467
24.3; locate-library returning spurious path
Previous Next
Reported by: Alex Kosorukoff <alex <at> 3form.com>
Date: Sun, 11 May 2014 16:51:02 UTC
Severity: minor
Tags: patch
Found in version 24.3
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Stefan Monnier <monnier <at> 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
This bug report was last modified 4 years and 226 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.