branch: externals/compat commit e5ec04fea3535e13a374a4b3ed5fd08038c0124c Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
Eagerly expand macros in compat-entwine In order for `compat--entwine-version' to be passed on to the macro generator functions, we cannot just bind the variable within the macro and forget about it. Generating a let binding instead of a `progn'-block is likewise insufficient, as this would only affect the evaluation, not the macro-expansion. It is therefore necessary to expand all macros (or at least all macros using `compat--generate-function', which for our intent is almost every case) while binding `compat--entwine-version', so that the binding is preserved. If this is not done, the version cannot be determined when loading compat.el (the main file). To my understanding this is not fatal, because all this affects is that compat.elc cannot be generated, so the slower compat.el has to be loaded. --- compat.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compat.el b/compat.el index abe43d9204..27ec49227a 100644 --- a/compat.el +++ b/compat.el @@ -77,6 +77,7 @@ ;; compat.el is being compiled. ;; cd compat && make clean all (bound-and-true-p byte-compile-current-file))))) + (compat--entwine-version (number-to-string version)) defs) (with-temp-buffer (insert-file-contents file) @@ -84,8 +85,7 @@ (while (progn (forward-comment 1) (not (eobp))) - (let ((compat--entwine-version (format "%d.1" version)) - (form (read (current-buffer)))) + (let ((form (read (current-buffer)))) (cond ((memq (car-safe form) '(compat-defun @@ -97,7 +97,7 @@ '(declare-function defvar)) (push form defs)))))) - (macroexp-progn (nreverse defs))))))) + (macroexpand-all (macroexp-progn (nreverse defs)))))))) (compat-entwine 24) (compat-entwine 25)