From 8d81704d61153f13de516475f4e0ab53e8e94f11 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sun, 14 Apr 2024 09:36:05 +0200 Subject: [PATCH] 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. --- lisp/emacs-lisp/pp.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el index d586fc59939..f89807c37be 100644 --- a/lisp/emacs-lisp/pp.el +++ b/lisp/emacs-lisp/pp.el @@ -327,7 +327,8 @@ pp-display-expression 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 @@ pp-display-expression (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))))) -- 2.44.0