]> git.eshelyaron.com Git - emacs.git/commitdiff
Propagate 'lexical-binding' value to pp buffers
authorAugusto Stoffel <arstoffel@gmail.com>
Sun, 14 Apr 2024 07:36:05 +0000 (09:36 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 20 Apr 2024 11:04:33 +0000 (14:04 +0300)
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)

lisp/emacs-lisp/pp.el

index 33b583a8ffa3aaa4167b6c4ae7e18a24a5343db7..151791e842687345b6b00b2637b1488c3b44c7f5 100644 (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 buffer-undo-list nil)
         (setq-local font-lock-verbose nil)))))