emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 292f50d: Make lambda/closure help buttons format as Emacs Lisp


From: Lars Ingebrigtsen
Subject: master 292f50d: Make lambda/closure help buttons format as Emacs Lisp
Date: Thu, 4 Nov 2021 16:53:05 -0400 (EDT)

branch: master
commit 292f50d27b399370809ccb6bbabc365120fc2256
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make lambda/closure help buttons format as Emacs Lisp
    
    * lisp/help.el (help--describe-command): Format lambda/closures as
    Emacs Lisp.
    
    * lisp/emacs-lisp/pp.el (pp-display-expression): Allow formatting
    as Emacs Lisp.
---
 lisp/emacs-lisp/pp.el | 9 +++++++--
 lisp/help.el          | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 5a643d9..ca3f2a2 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -90,8 +90,10 @@ Output stream is STREAM, or value of `standard-output' 
(which see)."
   (princ (pp-to-string object) (or stream standard-output)))
 
 ;;;###autoload
-(defun pp-display-expression (expression out-buffer-name)
+(defun pp-display-expression (expression out-buffer-name &optional lisp)
   "Prettify and display EXPRESSION in an appropriate way, depending on length.
+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)
@@ -119,7 +121,10 @@ after OUT-BUFFER-NAME."
                       (message "See buffer %s." out-buffer-name)))
                 (message "%s" (buffer-substring (point-min) (point))))))))
     (with-output-to-temp-buffer out-buffer-name
-      (pp expression)
+      (if lisp
+          (with-current-buffer standard-output
+            (pp-emacs-lisp-code expression))
+        (pp expression))
       (with-current-buffer standard-output
        (emacs-lisp-mode)
        (setq buffer-read-only nil)
diff --git a/lisp/help.el b/lisp/help.el
index d10ea1c..2a72656 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1347,7 +1347,7 @@ Return nil if the key sequence is too long."
                           (symbol-name (car definition))
                           (lambda (_)
                             (pp-display-expression
-                             definition "*Help Source*"))))))
+                             definition "*Help Source*" t))))))
         (t
          (insert "??\n"))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]