aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2020-05-31 16:46:06 +0000
committerAlan Mackenzie2020-05-31 16:46:06 +0000
commitcc340da1fe853dc52c894d6660384e09bb9a9302 (patch)
tree74509204b14b40dc0bbf0209973cb59bccf96da5
parent41232e679732fcd37fc56edda90035d6f98b591f (diff)
downloademacs-cc340da1fe853dc52c894d6660384e09bb9a9302.tar.gz
emacs-cc340da1fe853dc52c894d6660384e09bb9a9302.zip
Fix bug #41618 "(byte-compile 'foo) errors when foo is a macro."
* lisp/emacs-lisp/bytecomp.el (byte-compile): Disentangle the eval of the final form from the pushing of 'macro onto it, doing the former first.
-rw-r--r--lisp/emacs-lisp/bytecomp.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 688f8cfa4db..5479e6536a3 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2796,14 +2796,15 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2796 ;; Expand macros. 2796 ;; Expand macros.
2797 (setq fun (byte-compile-preprocess fun)) 2797 (setq fun (byte-compile-preprocess fun))
2798 (setq fun (byte-compile-top-level fun nil 'eval)) 2798 (setq fun (byte-compile-top-level fun nil 'eval))
2799 (if macro (push 'macro fun))
2800 (if (symbolp form) 2799 (if (symbolp form)
2801 ;; byte-compile-top-level returns an *expression* equivalent to the 2800 ;; byte-compile-top-level returns an *expression* equivalent to the
2802 ;; `fun' expression, so we need to evaluate it, tho normally 2801 ;; `fun' expression, so we need to evaluate it, tho normally
2803 ;; this is not needed because the expression is just a constant 2802 ;; this is not needed because the expression is just a constant
2804 ;; byte-code object, which is self-evaluating. 2803 ;; byte-code object, which is self-evaluating.
2805 (fset form (eval fun t)) 2804 (setq fun (eval fun t)))
2806 fun))))))) 2805 (if macro (push 'macro fun))
2806 (if (symbolp form) (fset form fun))
2807 fun))))))
2807 2808
2808(defun byte-compile-sexp (sexp) 2809(defun byte-compile-sexp (sexp)
2809 "Compile and return SEXP." 2810 "Compile and return SEXP."