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

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

Re: [External] : Re: Native compilation


From: Eli Zaretskii
Subject: Re: [External] : Re: Native compilation
Date: Thu, 13 Jan 2022 09:05:35 +0200

> Date: Wed, 12 Jan 2022 23:38:36 +0100
> From:  Emanuel Berg via Users list for the GNU Emacs text editor 
> <help-gnu-emacs@gnu.org>
> 
> > Natively-compiling Lisp files needs to make sure they are
> > self-contained, i.e. they don't depend on other Lisp files
> > that are not explicitly 'load'ed or 'require'd in them.
> > Otherwise you will have warnings and errors during JIT
> > native-compilation.
> 
> Yes, but that's completely natural ... good, even?

Quite a few people are annoyed by the many warnings they get in this
case.

> > Natively-compiling Lisp files also means you'll need to have
> > the original Lisp files around, or else Emacs will refuse to
> > load the .eln file. If you compress the source file, you
> > need to have Emacs built with decompression support (zlib),
> > otherwise Emacs will refuse to load the .eln file, claiming
> > that the source isn't available.
> 
> Okay, why?

Because Emacs needs to be sure the .eln file corresponds to the
.el/.elc, otherwise the session might crash.

> >> Right, it doesn't look like it, either. So how do you
> >> natively byte-compile the file x.el?
> >
> > By using one or more of special commands designed for that.
> 
> Which are?
> 
> Or where is this documented perhaps better ...

In the manual, of course.  And also this should help:

   M-x apropos RET native.*compile RET

> >> Native byte-compilation of GNU Emacs (vanilla Emacs) Elisp.
> >
> > It happens automatically when Emacs loads a .elc file whose
> > .el file can be found in the usual places, yes.
> 
> What places are these?

Near the .el file and on load-path, of course.

> I have the .elc files and they are in the same directory as
> the .el files - okay, so maybe they are indeed
> natively byte-compiled already?

Probably.  Look in the eln-cache directory.

> .eln files do exist in ~/.emacs.d/eln-cache/29.0.50-9e08bfb0
> including my files, e.g. time-incal-760bfd05-7cbfad50.eln -
> okay, so maybe that's why I got the warning/error for just one
> file, .emacs - because .emacs is named .emacs and not
> emacs.el?

If you have .emacs.elc somewhere, and it said it couldn't find the
source of it, then that's the reason.  If you don't have .emacs.elc,
it will not try to natively-compile .emacs.  The eln-cache has nothing
to do with that, because the sources aren't supposed to be there and
aren't being looked up there.



reply via email to

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