bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Alex Kosorukoff
Subject: bug#17467: 24.3; locate-library returning spurious path
Date: Sun, 11 May 2014 17:20:23 -0700

On Sun, May 11, 2014 at 2:56 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> The issue is that locate-library returns spurious paths like ".*/tramp" or
> ".*xxx/tramp.gz"

I don't see why these are necessarily spurious.  Please give very
concrete examples, so as to make it crystal clear why they're spurious.

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. 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? I think the main difference is that I assume that this list is exhaustive and you imply that it is not. You can prove me wrong by a single example.

> This is both unexpected and incorrect given this function name and
> spec.

Unexpected to you, obviously, but I'm not convinced it's unexpected in
general (after all, I don't remember other bug-reports in this area) and
definitely not incorrect.  See the docstring of `load':

   Execute a file of Lisp code named FILE.
   First try FILE with `.elc' appended, then try with `.el',
   then try FILE unmodified (the exact suffixes in the exact order are
   determined by `load-suffixes').  Environment variable references in
   [...]

By incorrect, I only meant that the function fails to do what its name suggests when it returns something other than a library. My understanding is that load is used to load any files, not just libraries.
 
Of course, there's an ambiguity about how the search is performed,
w.r.t. to whether it does:

   (dolist (s suffixes) (dolist (d load-path) ...)))
or
   (dolist (d load-path) (dolist (s suffixes) ...)))

We do the second, so that a compiled file in a later directory does not
override a non-compiled file in an earlier directory.

Yes, I noticed that require won't attempt to load files like "trump" or "trump.gz" even if they are in the load-path, unlike load that will try to load any file regardless of its suffix. My understanding was that require is used to load libraries, while load is used to load general files.



        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]