[Top][All Lists]

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

More reliable byte compilation, take 45

From: Lars Ingebrigtsen
Subject: More reliable byte compilation, take 45
Date: Mon, 04 Oct 2021 12:51:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Various schemes to make byte compilation more reliable has been mooted,
but none have been practical.

To recap: The problem is that if we change a macro in foo.el, and bar.el
uses that macro, bar.el won't be recompiled after changing the macro in

A defensive solution would be to recompile all libraries that require a
library, building a dependency tree from require/autoloads/etc, but the
problem is then that if you edit anything in subr.el, then you have to
recompile all the .el files, basically.  So it's not practical.

So we want a solution that's 1) fairly fast and 2) somewhat reliable.  A
100% solution isn't necessary -- just something that's less "well, just
say 'make bootstrap' then".

So here's the idea of the day:

make macro-recompile

would go through all the .el files and just look for "^\(defmacro ([^
\t\n]+)" (and defsubst and cl-defstruct and probably a couple of other
things, but not a whole lot more), and then do a sha256 of the region
from the start of the match and until the next "^(".  It would maintain
a database of these macro names/hashes.  If a macro changes its hash, it
would then just grep through all the .el files for the macro name, and
delete the .elc files where it fines matches.

The point here is to make it feasible to alter macros and see whether
there's any horrible fall-out immediately, with some confidence.  So it
has to be fast, and not result in too much recompilation.

So writing a little C helper program to do the hashing stuff might
possibly be the way to go here.

Does this sound feasible and useful?

(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

reply via email to

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