1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

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)
This commit is contained in:
Eli Zaretskii 2024-05-18 12:55:34 +03:00
parent be03dda5b0
commit 82a31e27e6

View file

@ -1557,13 +1557,16 @@ character)."
(pcase-let*
((`(,insert-value ,no-truncate ,char-print-limit)
(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 (macroexpand-all
(eval-sexp-add-defvars
(elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp)))))
lexical-binding)
(if insert-value (current-buffer) t) no-truncate char-print-limit)))
;; The expression might change to a different buffer, so record the
;; desired output stream now.
(let ((output (if insert-value (current-buffer) t)))
;; Setup the lexical environment if lexical-binding is enabled.
(elisp--eval-last-sexp-print-value
(eval (macroexpand-all
(eval-sexp-add-defvars
(elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp)))))
lexical-binding)
output no-truncate char-print-limit))))
(defun elisp--eval-last-sexp-print-value
(value output &optional no-truncate char-print-limit)