emacs-devel
[Top][All Lists]
Advanced

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

Re: locate-library, the NOSUFFIX arg and a [PATCH]


From: Stefan Monnier
Subject: Re: locate-library, the NOSUFFIX arg and a [PATCH]
Date: Wed, 27 Jan 2010 09:55:50 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

>> This is not removing ".el.gz" from the return value.  This is removing
>> it from the search.
> You fist indicated that `locate-library' doesn't remove extensions.
> Now you acknowledge that it does.

I see that my explanation still left room for confusion:
1- «removing ".el.gz" from the return value» means that instead of
   returning "/bar/foo.el.gz" it would return "/bar/foo".
2- «removing it from the search» means that locate-library will not look
   for files that end in ".el.gz" at all.

I hope this is more clear now.  These two are completely different.
NOSUFFIX does what the case (2) does, not what the case (1) does.

>> I still do not know what this would be used for.  Could you explain the
>> actual use case you're thinking of?

> Assume I have the file "library.el.gz" in the directory "/home/mon/fnd-lib"
> Right if i ask for the location of "library" I get:

>  (locate-library "libary" t '("/home/mon/fnd-lib"))
>  => nil

> It would be really great to ask with:
>  (locate-library "libary" t '("/home/mon/fnd-lib") t)

> and get:
>  => "/home/mon/fnd-lib/library.el.gz"

I don't follow you.  If you want that, then why do you specify a non-nil
value for NOSUFFIX??

>> Could be.  Couldn't blame them.  Now that locate-file is available, I'd
>> recommend they use that instead.
> A file is not a library.

That's irrelevant.  `locate-library' returns a file name, not a library name.

>>> (kill-new (locate-library "subr"))
>> What does this use case show?
> I asked to kill a library,

No, you didn't.  Check the docstring of locate-library:

  "Show the precise file name of Emacs library LIBRARY."

I.e. it returns a file name, so you asked to "kill" a file name.

> I maybe kill a file-name or maybe I kill a nil.  Where I do kill
> a file-name it is unspecified which file-name I killed.

I have no idea what kind of "specification" you'd expect other than the
one you currently get from locate-library's docstring.

>> What's the problem with it?
> The problem is that at best I kill an unspecific file name.

Then don't do that.  Seen from here, it looks like you're using
locate-library to do something else than what it does; although I'm not
100% positive it's the case because I don't really know what it is you
want (kill-new (locate-library "subr")) to do.

>> Stripping the extension is not the issue. I asked to kill
>> a library namestring.
>> What is "a library namestring"?
> A string that names the location of a library up to but not including that
> library's extension.

Ah, now I see.  This notion of "library name stripped of its extension"
is not one that Emacs uses much, AFAIK.

Why do you want it without the extension?
Depending on this question, we may be able to determine things like
whether you'd like (your-locate-library "foo.el" t) to return "/bar/foo"
or "/bar/foo.el".

> IOW what you _should_ get when you want to know where a library lives
> but don't want a filename.

Since locate-library returns a filename and you "don't want a filename",
it's no wonder you don't like the return value of locate-library.


        Stefan




reply via email to

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