unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: MON KEY <monkey@sandpframing.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: locate-library, the NOSUFFIX arg and a [PATCH]
Date: Wed, 27 Jan 2010 20:09:31 -0500	[thread overview]
Message-ID: <d2afcfda1001271709m575e8bbfr4f1ce9a52783ac31@mail.gmail.com> (raw)
In-Reply-To: <jwvd40vligx.fsf-monnier+emacs@gnu.org>

On Wed, Jan 27, 2010 at 9:55 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>
> I see that my explanation still left room for confusion:

Stefan, I'm not the dimmest bulb in the drawer; This is your third attempt at
rephrasing the existing functionality.

>
> 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.

Thank you for this explanation.

Following is a rhetorical question; but if it helps you to see the problem then
by all means feel free to continue with the enumeratiation. Why won't it return
for "/my/bar/foo.el" either but it will return for "/my/bar/foo.gz"? e.g.

 (locate-library "foo" t '("/my/bar"))

>> 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??

Look closely. The fourth arg of the second example is using the proposed
SHOW-COMPRESSED. Which says, "Show me the file name sans extension unless
library name is a compressed file in which case let me know by showing me the
extension.

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

Not entirely irrelevant.  What is a library name then?

If there is a distinction between a library and a file it is not clear.

How exactly should one specify a library name for the LIBRARY arg to
locate-library if this is not the same object(s) as a file name?

Please understand, my intention is not to be pedantic. It is important
that if there is a distinction between the two that it be specified.

>> 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.
>

Hrmmm. Precisely what is, "the precise file name of an Emacs library"?

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

Agreed. Hence the conundrum.

>
> Then don't do that.
> Seen from here, it looks like you're using
> locate-library to do something else than what it does;

Indeed. It is obviously pathological (as was indicated in the orignial context).

> 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.
>

This was provided as an example where I found the expected behavior surprising.

A better example use-case for the proposed patch might be where one would like
to generate a list from which one could inform/extend/override
`emacs-lisp-file-regexp', `byte-compile-dest-file', `declare-function',
`check-declare-directory', `byte-compiler-base-file-name', etc. to
select/operate on a library per case based conditionals of the list elements.

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

You say this is an esoteric feature but if it does indeed exist please tell me
its name maybe I can use it to scratch this itch...

It is a notion used all the time just from the other direction, i.e. by
stripping instead of adding it back on. Likewise, it is a notion which will be
required more with increased package support and distributed/versioned code and
is IMHO a likely eventuality required in each arena. This NOSUFFIX problem is
compounded when there are duplicate library's across multiple dir
hierarchies. FWIW you have a fully fleshed abstraction for objects
now... This is
exactly the type of feature they are great at abstracting.

>
> Why do you want it without the extension?
>

Why wouldn't I? :)

I do do want the extension, but I would prefer to set the conditions upon which
the extensions are made available.

> 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".

Exactly.

>
> 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.
>

Don't twist me off axis.
What I don't want is a file name where a library name is requested.

To the extent that `locate-library' is essentially obsoleted by `locate-file'
what is the big deal changing it ;-)

>
>        Stefan

/s_P\




  reply	other threads:[~2010-01-28  1:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19 22:28 locate-library, the NOSUFFIX arg and a [PATCH] MON KEY
2010-01-21 14:08 ` Stefan Monnier
2010-01-21 23:58   ` MON KEY
2010-01-22 15:18     ` Stefan Monnier
2010-01-23  2:10       ` MON KEY
2010-01-23 11:23         ` Stefan Monnier
2010-01-24  1:39           ` MON KEY
2010-01-25  3:23             ` Stefan Monnier
2010-01-27  4:25               ` MON KEY
2010-01-27 14:55                 ` Stefan Monnier
2010-01-28  1:09                   ` MON KEY [this message]
2010-01-28  2:46                     ` Stefan Monnier
2010-01-29  2:55                       ` MON KEY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2afcfda1001271709m575e8bbfr4f1ce9a52783ac31@mail.gmail.com \
    --to=monkey@sandpframing.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).