[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17467: 24.3; locate-library returning spurious path
From: |
Stefan Monnier |
Subject: |
bug#17467: 24.3; locate-library returning spurious path |
Date: |
Sun, 11 May 2014 22:18:03 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> I think these file names are more appropriate for data files, not
> executable ones. It is undesirable that a name "tramp.gz" will shadow a
> valid library file "tramp.elc" that won't be found as a result.
I think I'm beginning to see what you mean. So far we have simply
considered "if it hurts, don't do it". And it worked well enough.
> When you say those names aren't spurious, do you have a particular
> example of an emacs elisp library in mind which file name ends with
> a suffix other than .el .elc .el.gz .elc.gz?
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.
Stefan
=== modified file 'lisp/subr.el'
--- lisp/subr.el 2014-04-15 17:03:15 +0000
+++ lisp/subr.el 2014-05-12 02:15:04 +0000
@@ -1878,10 +1878,15 @@
load-path (get-load-suffixes)))
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))
- bug#17467: 24.3; locate-library returning spurious path, (continued)
- bug#17467: 24.3; locate-library returning spurious path, Stefan Monnier, 2014/05/11
- bug#17467: 24.3; locate-library returning spurious path, Alex Kosorukoff, 2014/05/11
- bug#17467: 24.3; locate-library returning spurious path, Stefan Monnier, 2014/05/11
- bug#17467: 24.3; locate-library returning spurious path, Alex Kosorukoff, 2014/05/11
- bug#17467: 24.3; locate-library returning spurious path, Glenn Morris, 2014/05/11
- bug#17467: 24.3; locate-library returning spurious path, Alex Kosorukoff, 2014/05/11
- bug#17467: 24.3; locate-library returning spurious path, Alex Kosorukoff, 2014/05/11
- bug#17467: 24.3; locate-library returning spurious path,
Stefan Monnier <=
- bug#17467: 24.3; locate-library returning spurious path, Alex Kosorukoff, 2014/05/12
- bug#17467: 24.3; locate-library returning spurious path, Stefan Monnier, 2014/05/12
- bug#17467: 24.3; locate-library returning spurious path, Alex Kosorukoff, 2014/05/12
bug#17467: 24.3; locate-library returning spurious path, Stefan Monnier, 2014/05/15