Subject: bug#2061: Fwd: Loading .el when newer than .elc

From: Reuben Thomas <[email-masked]>
Date: Tue, 11 Feb 2014 12:48:42 +0000

I just got annoyed enough about missing a warning that an .el file is newer
than an .elc file to want to file a bug report, and sure enough found this
issue has already been discussed.

To summarize the discussion so far, the following reasons have been
advanced for not wanting automatically to prefer a newer .el over an older
.elc:

1. One might be working on the .el file, and not want to load it yet.

2. This is a bug, which should be fixed by recompiling the .el.

Several workarounds have been proposed for those who want to use the newest
version of the .el; they all involve recompiling the file (which some
people complained slowed things down too much, and others pointed out could
lead to loops when working on a large project), and all involve taking
action for specific files, e.g. per-project, or per-file, or per-directory.

I think it's worth looking at those objections again in a modern context:

1. We don't work on deployed code any more (or shouldn't!). We use version
control systems, we run tests before deploying. When I fiddle with a file,
I always want my changes to take effect instantly: either I'm working on
code I'm developing, or I'm trying a fix on a deployed file (and am willing
to keep the bits if it breaks!).

2. GNU distributions go to some lengths to ensure that all system-installed
.el files are compiled and up-to-date. el-get does the same for
user-installed packages. There's little else.

Meanwhile, the workarounds require almost as much effort to install and
maintain as simply remembering to byte-compile everything.

Personally, I have wasted hours by thinking I'm loading a new .el when I'm
loading an old .elc, plus going through various recompilation dances when I
do remember. The time that defaulting to .elc has saved me is minimal,
owing to Debian+el-get taking care of recompilation.

Hence, could we have a preference that reverses the behavior, i.e. when the
.el is newer, it is loaded, and a warning emitted? The default behavior
should of course remain the same. It's a simple, uniform, discoverable
solution. I'd happily work up a patch myself. The preference could be used
in .dir-locals.el by users who preferred to switch it on only for, say,
per-user site-lisp directories or project directories.

How about: load-el-when-newer (defaults to nil) ?

--
http://rrt.sc3d.org