commit 8ca54f61fae78837b27036df1ecd19b1c5fc3834
parent 91ca5303f7ee2aae6935f0b0a3d9fd8f93ca30e7
Author: Wilfred Hughes <me@wilfred.me.uk>
Date: Mon, 4 Sep 2017 23:04:37 +0100
Add a helpful-key command
Fixes #14
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -13,6 +13,9 @@ Added a command `helpful-callable`, which offers both macros and
functions. This should be a drop-in replacement for
`describe-function`.
+Added a command `helpful-key`, which offers help on keybindings much
+like `describe-key`.
+
# v0.1
First release.
diff --git a/helpful.el b/helpful.el
@@ -701,6 +701,18 @@ For example, \"(some-func FOO &optional BAR)\"."
(helpful-update))
;;;###autoload
+(defun helpful-key (key-sequence)
+ "Show help for interactive command bound to KEY-SEQUENCE."
+ (interactive
+ (list (read-key-sequence "Press key: ")))
+ (let ((sym (key-binding key-sequence)))
+ (unless sym
+ (user-error "No command is bound to %s"
+ (key-description key-sequence)))
+ (switch-to-buffer (helpful--buffer sym t))
+ (helpful-update)))
+
+;;;###autoload
(defun helpful-macro (symbol)
"Show help for macro named SYMBOL."
(interactive