[Top][All Lists]

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

[Emacs-diffs] master b877afd: * lisp/progmodes/elisp-mode.el (eval-sexp-

From: Stefan Monnier
Subject: [Emacs-diffs] master b877afd: * lisp/progmodes/elisp-mode.el (eval-sexp-add-defvars): Don't macroexpand.
Date: Sun, 18 Feb 2018 13:02:35 -0500 (EST)

branch: master
commit b877afdfd37d7cdf13ce60c6dc2186d5a0141724
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * 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.
 lisp/progmodes/elisp-mode.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index e6e55a3..935e55c 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1132,7 +1132,9 @@ character)."
         (eval-expression-get-print-arguments eval-last-sexp-arg-internal)))
     ;; Setup the lexical environment if lexical-binding is enabled.
-     (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)

reply via email to

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