diff options
| author | Eli Zaretskii | 2024-05-18 12:55:34 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-05-18 12:55:34 +0300 |
| commit | 82a31e27e6ceed17a116286d2f0f9810be2e1772 (patch) | |
| tree | d36231e1bc927cad03d34a5729154cf1e5400bb7 | |
| parent | be03dda5b0fc55e989bfa707c73f1cc990e24c3b (diff) | |
| download | emacs-82a31e27e6ceed17a116286d2f0f9810be2e1772.tar.gz emacs-82a31e27e6ceed17a116286d2f0f9810be2e1772.zip | |
Fix printing the result by 'eval-print-last-sexp'
* lisp/progmodes/elisp-mode.el (elisp--eval-last-sexp): Record the
desired output stream before evaluating the expression.
(Bug#70931)
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 84814c9eaac..7d0312eb2a4 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -1557,13 +1557,16 @@ character)." | |||
| 1557 | (pcase-let* | 1557 | (pcase-let* |
| 1558 | ((`(,insert-value ,no-truncate ,char-print-limit) | 1558 | ((`(,insert-value ,no-truncate ,char-print-limit) |
| 1559 | (eval-expression-get-print-arguments eval-last-sexp-arg-internal))) | 1559 | (eval-expression-get-print-arguments eval-last-sexp-arg-internal))) |
| 1560 | ;; Setup the lexical environment if lexical-binding is enabled. | 1560 | ;; The expression might change to a different buffer, so record the |
| 1561 | (elisp--eval-last-sexp-print-value | 1561 | ;; desired output stream now. |
| 1562 | (eval (macroexpand-all | 1562 | (let ((output (if insert-value (current-buffer) t))) |
| 1563 | (eval-sexp-add-defvars | 1563 | ;; Setup the lexical environment if lexical-binding is enabled. |
| 1564 | (elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp))))) | 1564 | (elisp--eval-last-sexp-print-value |
| 1565 | lexical-binding) | 1565 | (eval (macroexpand-all |
| 1566 | (if insert-value (current-buffer) t) no-truncate char-print-limit))) | 1566 | (eval-sexp-add-defvars |
| 1567 | (elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp))))) | ||
| 1568 | lexical-binding) | ||
| 1569 | output no-truncate char-print-limit)))) | ||
| 1567 | 1570 | ||
| 1568 | (defun elisp--eval-last-sexp-print-value | 1571 | (defun elisp--eval-last-sexp-print-value |
| 1569 | (value output &optional no-truncate char-print-limit) | 1572 | (value output &optional no-truncate char-print-limit) |