diff options
| author | Philip Kaludercic <philipk@posteo.net> | 2022-06-17 08:56:10 +0200 |
|---|---|---|
| committer | Philip Kaludercic <philipk@posteo.net> | 2022-06-17 09:02:41 +0200 |
| commit | e5ec04fea3535e13a374a4b3ed5fd08038c0124c (patch) | |
| tree | 66ce632d9ab00fb0bd64e29fff2a59ac9199e7c4 | |
| parent | b75491b95ead07ca2cd02c128037c08882b046b4 (diff) | |
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.
| -rw-r--r-- | compat.el | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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) |
