1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

* lisp/progmodes/elisp-mode.el (eval-sexp-add-defvars): Don't macroexpand.

Otherwise it breaks C-M-x on (progn (defmacro x ..) (... (x ...))).
Furthermore, many callers do their own macroexpansion anyway.
(elisp--eval-last-sexp): Do macroexpansion to make up for it.
This commit is contained in:
Stefan Monnier 2018-02-18 13:02:29 -05:00
parent 066e633cb6
commit b877afdfd3

View file

@ -1132,7 +1132,9 @@ character)."
(eval-expression-get-print-arguments eval-last-sexp-arg-internal)))
;; Setup the lexical environment if lexical-binding is enabled.
(elisp--eval-last-sexp-print-value
(eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding)
(eval (macroexpand-all
(eval-sexp-add-defvars (elisp--preceding-sexp)))
lexical-binding)
(if insert-value (current-buffer) t) no-truncate char-print-limit)))
(defun elisp--eval-last-sexp-print-value
@ -1165,7 +1167,6 @@ character)."
(defun eval-sexp-add-defvars (exp &optional pos)
"Prepend EXP with all the `defvar's that precede it in the buffer.
POS specifies the starting position where EXP was found and defaults to point."
(setq exp (macroexpand-all exp)) ;Eager macro-expansion.
(if (not lexical-binding)
exp
(save-excursion