Propagate 'lexical-binding' value to pp buffers

See bug#70137.

* lisp/emacs-lisp/pp.el (pp-display-expression): Set lexical-binding to
match the value in the calling buffer.
This commit is contained in:
Augusto Stoffel 2024-04-14 09:36:05 +02:00 committed by Stefan Monnier
parent 0dbd9ed046
commit 3cdd86b8af

View file

@ -327,7 +327,8 @@ If LISP, format with `pp-emacs-lisp-code'; use `pp' otherwise.
If a temporary buffer is needed for representation, it will be named
after OUT-BUFFER-NAME."
(let* ((old-show-function temp-buffer-show-function)
(let* ((lexical lexical-binding)
(old-show-function temp-buffer-show-function)
;; Use this function to display the buffer.
;; This function either decides not to display it at all
;; or displays it in the usual way.
@ -357,6 +358,7 @@ after OUT-BUFFER-NAME."
(pp expression))
(with-current-buffer standard-output
(emacs-lisp-mode)
(setq lexical-binding lexical)
(setq buffer-read-only nil)
(setq-local font-lock-verbose nil)))))