]> git.eshelyaron.com Git - emacs.git/commitdiff
Make lambdas/closures/byte code in `C-h b' clickable
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 2 Nov 2021 15:20:15 +0000 (16:20 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 2 Nov 2021 15:20:19 +0000 (16:20 +0100)
* 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
lisp/help.el

index 0bf774dffd810f1ffc5f0648168fb91989bc213d..4ff2cd59eba419fda89de098b4a16a9659762836 100644 (file)
@@ -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
index 77c5d124debe87c8327010ae5653e5d18f4bc0fc..9f7e1a90cf49a336b7c763fa3c441fdce5af3224 100644 (file)
@@ -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"))))