diff options
| author | Stefan Monnier | 2018-02-18 13:02:29 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2018-02-18 13:02:29 -0500 |
| commit | b877afdfd37d7cdf13ce60c6dc2186d5a0141724 (patch) | |
| tree | 3c138f7654b6fc19c7c17cd92915875135790d8e | |
| parent | 066e633cb6dacb846c0ac070c8d7d77985af8620 (diff) | |
| download | emacs-b877afdfd37d7cdf13ce60c6dc2186d5a0141724.tar.gz emacs-b877afdfd37d7cdf13ce60c6dc2186d5a0141724.zip | |
* 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.
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index e6e55a37a7c..935e55c5d70 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -1132,7 +1132,9 @@ character)." | |||
| 1132 | (eval-expression-get-print-arguments eval-last-sexp-arg-internal))) | 1132 | (eval-expression-get-print-arguments eval-last-sexp-arg-internal))) |
| 1133 | ;; Setup the lexical environment if lexical-binding is enabled. | 1133 | ;; Setup the lexical environment if lexical-binding is enabled. |
| 1134 | (elisp--eval-last-sexp-print-value | 1134 | (elisp--eval-last-sexp-print-value |
| 1135 | (eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding) | 1135 | (eval (macroexpand-all |
| 1136 | (eval-sexp-add-defvars (elisp--preceding-sexp))) | ||
| 1137 | lexical-binding) | ||
| 1136 | (if insert-value (current-buffer) t) no-truncate char-print-limit))) | 1138 | (if insert-value (current-buffer) t) no-truncate char-print-limit))) |
| 1137 | 1139 | ||
| 1138 | (defun elisp--eval-last-sexp-print-value | 1140 | (defun elisp--eval-last-sexp-print-value |
| @@ -1165,7 +1167,6 @@ character)." | |||
| 1165 | (defun eval-sexp-add-defvars (exp &optional pos) | 1167 | (defun eval-sexp-add-defvars (exp &optional pos) |
| 1166 | "Prepend EXP with all the `defvar's that precede it in the buffer. | 1168 | "Prepend EXP with all the `defvar's that precede it in the buffer. |
| 1167 | POS specifies the starting position where EXP was found and defaults to point." | 1169 | POS specifies the starting position where EXP was found and defaults to point." |
| 1168 | (setq exp (macroexpand-all exp)) ;Eager macro-expansion. | ||
| 1169 | (if (not lexical-binding) | 1170 | (if (not lexical-binding) |
| 1170 | exp | 1171 | exp |
| 1171 | (save-excursion | 1172 | (save-excursion |