emacs-diffs
[Top][All Lists]
Advanced

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

master cd73ec7: Make lambdas/closures/byte code in `C-h b' clickable


From: Lars Ingebrigtsen
Subject: master cd73ec7: Make lambdas/closures/byte code in `C-h b' clickable
Date: Tue, 2 Nov 2021 11:20:24 -0400 (EDT)

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

    Make lambdas/closures/byte code in `C-h b' clickable
    
    * lisp/help.el (help--describe-command): Add links for
    lambdas/closures/byte code (bug#24235).
    
    * lisp/emacs-lisp/pp.el (pp-display-expression): Autoload.
---
 lisp/emacs-lisp/pp.el |  1 +
 lisp/help.el          | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 0bf774d..4ff2cd5 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -85,6 +85,7 @@ can handle, whenever this is possible.
 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)
   "Prettify and display EXPRESSION in an appropriate way, depending on length.
 If a temporary buffer is needed for representation, it will be named
diff --git a/lisp/help.el b/lisp/help.el
index 77c5d12..9f7e1a9 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1352,10 +1352,16 @@ Return nil if the key sequence is too long."
         ((keymapp definition)
          (insert "Prefix Command\n"))
         ((byte-code-function-p definition)
-         (insert "[byte-code]\n"))
+         (insert "[%s]\n"
+                 (button-buttonize "byte-code" #'disassemble definition)))
         ((and (consp definition)
               (memq (car definition) '(closure lambda)))
-         (insert (format "[%s]\n" (car definition))))
+         (insert (format "[%s]\n"
+                         (button-buttonize
+                          (symbol-name (car definition))
+                          (lambda (_)
+                            (pp-display-expression
+                             definition "*Help Source*"))))))
         (t
          (insert "??\n"))))
 



reply via email to

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