[Top][All Lists]

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

Re: user-init-file source vs. compiled

From: Juanma Barranquero
Subject: Re: user-init-file source vs. compiled
Date: Fri, 2 Feb 2007 17:03:35 +0100

On 2/2/07, Stefan Monnier <address@hidden> wrote:

10% smaller will result in a non-measurably faster load, and will still take
90% more disk space.  So what's the advantage again?

The wonderful, perhaps subjective feeling that it is loading faster :)

I don't want to make it impossible to byte-compile your .emacs.  If that's
really what you want, go for it.

I've been using Emacs for nine years and I just started to
byte-compile my .emacs a week ago, so it's not a matter of me "really
wanting". This thread was about a variable's description being
inaccurate (fortunately it is now fixed).

I'm just saying that we should discourage
people from doing that, because too many users think "oh Emacs takes a long
time to start, I bet if I byte-compile it it'll start faster", but it turns
out it's not faster and next time they forget to re-compile their .emacs
they get bitten.

I've added this to my site-start.el:

(catch 'init-file
 (dolist (source-file '("~/.emacs.el" "~/.emacs." "~/_emacs.el"
                        "~/_emacs" "~/.emacs.d/init.el"))
   (when (file-exists-p source-file)
     (require 'bytecomp)
     (unless (fboundp 'time-less-p) (require 'time-date))
     (let ((byte-file (byte-compile-dest-file source-file)))
       (when (and (file-exists-p byte-file)
                  (time-less-p (nth 5 (file-attributes byte-file))
                               (nth 5 (file-attributes source-file))))
         (unless (byte-compile-file source-file)
           (setq init-file-user nil))))
     (throw 'init-file t))))

which recompiles my .emacs.el if needed (the compilation log is quite
visible, so I don't miss that something happened), with the added
benefit that .emacs(.elc?)? is not loaded if the compilation fails.

It's not the most common problem on gnu.emacs.help, but
it's sufficiently common that I think the potential very minor advantage(s)
is just not worth it.

By all means, if you think users should not compile their .emacs
unless they know what they're doing, just add a prominent notice to
the relevant docs. You're talking about what should we recommend; I
was just talking about not misleading people, given the fact that
bytecompiling .emacs is *allowed*. I have no opinion on whether we
should en- or discourage bytecompiling the init file.

OTOH I'm in favor of adding some kind of hack so that the .emacs file
automatically goes through the byte-compiler's sanity checks when you save
it (so they user might can warnings about using obsolete

That's a really nice idea.


reply via email to

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