Subject: bug#17467: 24.3; locate-library returning spurious path

From: Alex Kosorukoff <[email-masked]>
Date: Sun, 11 May 2014 11:55:18 -0700

Yes, this makes sense. Here is a patch that the issues you mentioned.

(locate-library "tramp.el.gz")
(locate-library "tramp.el")
(locate-library "tramp")

all are working as expected

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [email-masked]
# target_branch: :parent
# testament_sha1: 66b596e6da58c1cb71dedd7fa9ba2fcf20e2964c
# timestamp: 2014-05-11 11:48:22 -0700
# base_revision_id: [email-masked]\
#   1mzcrftziwhrw9hl
#
# Begin patch
=== modified file 'lisp/subr.el'
--- lisp/subr.el        2014-04-09 01:48:07 +0000
+++ lisp/subr.el        2014-05-11 18:48:13 +0000
@@ -1857,10 +1857,13 @@
                                        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 ((file
+         (locate-file library
+                      (or path load-path)
+                      (unless (or nosuffix (string-suffix-p ".el.gz"
library))
+                        (if (string-suffix-p ".el" library)
+                            load-file-rep-suffixes
+                          (get-load-suffixes))))))
     (if interactive-call
        (if file
            (message "Library is file %s" (abbreviate-file-name file))

# Begin bundle

On Sun, May 11, 2014 at 11:10 AM, Eli Zaretskii <[email-masked]> wrote:

> > From: Alex Kosorukoff <[email-masked]>
> > Date: Sun, 11 May 2014 10:53:34 -0700
> > Cc: [email-masked]
> >
> > did you mean the following
> >
> > (locate-library "tramp.el") returning the path to tramp.el.gz?
>
> Yes.  But also (locate-library "tramp.el") being able to find
> tramp.el.
>