From: Augusto Stoffel Date: Sun, 14 Apr 2024 07:36:05 +0000 (+0200) Subject: Propagate 'lexical-binding' value to pp buffers X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8a953d5c65b2f812fad7550fdf538f9ef40c393e;p=emacs.git 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. (cherry picked from commit 3cdd86b8affa6d58de8f6d07b4e117676fedd58c) --- diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el index 33b583a8ffa..151791e8426 100644 --- a/lisp/emacs-lisp/pp.el +++ b/lisp/emacs-lisp/pp.el @@ -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 buffer-undo-list nil) (setq-local font-lock-verbose nil)))))