emacs-devel
[Top][All Lists]
Advanced

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

Re: master f8bb6cca33: Return the same file from locate-file in nativeco


From: Stefan Monnier
Subject: Re: master f8bb6cca33: Return the same file from locate-file in nativecomp and non
Date: Mon, 14 Mar 2022 12:57:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> E.g., is the result below expected, or is it a bug?
>
>   (locate-file "simple" native-comp-eln-load-path '(".eln"))
>     => nil

I assume you don't have a `simple.eln` file in your
`native-comp-eln-load-path`, so nil seems correct.

> Or what about load-history -- why does it only show the *.elc files
> loaded by the session, but not the *.eln files?

To better preserve compatibility.

> (This discussion was triggered by a conflict between load-history and
> locate-file, so load-history is definitely relevant to the issue
> at hand.)

The problem can't be "a conflict between load-history and locate-file".
There needs to be some code that links the two and tweaking
`locate-file` so it does what we happen to need can't the answer,
instead it has to be in the code that links the two.
Again `locate-file` is just a generic function, like
`locate-dominating-file`, or `file-attributes`.  If it doesn't do quite
what a specific function needs (e.g. `load` or `locate-library`), then
either that function needs to supplement `locate-file` with what it
needs, or it needs to use some other function.

You're right that the `openp` code probably needs further fixes to
better separate the `load` case from the other cases.  The way the
redirection from `.elc` to `.eln` was added to it is rather messy for
those uses that aren't `load`.  It happens to work OK largely because
executables tend not to use a `.elc` extension.

> should perhaps stop and think about this a bit harder.  E.g., maybe a
> simpleton that locate-file is no longer satisfies us for looking up
> Lisp files?

That's already the case: `load` supplements the code of `locate-file`
with some extra processing to look for a `.eln` after it found a `.elc`.

But in theory this replaces a call to `locate-file` with two calls to
that function (one to look for a file through `load-path` and then
another to look for a .eln version of the result through the
`native-comp-eln-load-path`), so it's not really an argument that
`locate-file` no longer satisfies us.
[ In practice it's implemented in a much more intertwined way in
  `openp`, and the second loop (through `native-comp-eln-load-path`
  doesn't reuse the code of locate-file/openp).  ]

> Is there such a big difference between "ask" (which you didn't) and
> "would suggest" (which you did)?

All I can say is that when I wrote that sentence I did not think it was
appropriate to put it right away into `emacs-28` (instead I thought,
like Lars, that it was better to see how it fares in `master` first).


        Stefan




reply via email to

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