branch: externals/inspector
commit f5e486882e8f0f7ef15cf945029ad5a00c4bfb7b
Author: Kristoffer Balintona <[email protected]>
Commit: Kristoffer Balintona <[email protected]>

    Define and document command to inspect Help buffer's symbol
---
 README.md    |  4 ++++
 inspector.el | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/README.md b/README.md
index df3bcfed85..5eb8bc93b2 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,10 @@ When on an Emacs debugging backtrace, press letter `i` to 
inspect the pointed fr
 
 When on edebug-mode, use `C-c C-i` for inspecting expressions in the debugger.
 
+### From Help buffers
+
+When in a *Help* buffer, such as the ones created from `describe-function`, 
`describe-variable`, `describe-keymap`, and `describe-symbol`, you can use M-x 
`inspector-inspect-help-buffer-expression` to inspect the symbol associated 
with that Help buffer.
+
 ### Setup evaluation commands using prefix arguments
 
 Instead of bothering setting up different key bindings for elisp evaluation 
and inspection, it can be handy to have both in the same command, and use 
prefix arguments to differenciate, like this:
diff --git a/inspector.el b/inspector.el
index 29f4a79861..7110b6873a 100644
--- a/inspector.el
+++ b/inspector.el
@@ -46,6 +46,12 @@
 ;; When on an Emacs debugging backtrace, press letter i to inspect the pointed 
frame and its local variables.
 ;;
 ;; When on edebug-mode, use C-c C-i for inspecting expressions in the debugger.
+;;
+;; From *Help* buffers:
+;;
+;; When in a *Help* buffer, such as the ones created from `describe-function', 
`describe-variable',
+;; `describe-keymap', and `describe-symbol', you can use M-x 
`inspector-inspect-help-buffer-expression'
+;; to inspect the symbol associated with that Help buffer.
 
 ;;; Code:
 
@@ -1009,6 +1015,16 @@ The environment used is the one when entering the 
activation frame at point."
 ;; Press 'C-c C-i' to inspect expression in edebug-mode
 (define-key edebug-mode-map (kbd "C-c C-i") 
#'inspector-inspect-edebug-expression)
 
+;; ----- help-mode---------------------------------------
+
+;;;###autoload
+(defun inspector-inspect-help-buffer-expression ()
+  "Inspect the current *Help* buffer\\='s symbol."
+  (interactive)
+  (if-let* ((expr (plist-get help-mode--current-data :symbol)))
+      (inspector-inspect (eval expr t))
+    (message "No symbol to inspect in Help buffer")))
+
 ;;--------- Inspector mode ---------------------------------
 
 (defvar inspector-mode-map

Reply via email to