diff options
| author | Wilfred Hughes <me@wilfred.me.uk> | 2017-09-04 23:04:37 +0100 |
|---|---|---|
| committer | Wilfred Hughes <me@wilfred.me.uk> | 2017-09-04 23:04:37 +0100 |
| commit | 8ca54f61fae78837b27036df1ecd19b1c5fc3834 (patch) | |
| tree | 12b2cffc0e533bcc73265ea48b3182d28abb7999 | |
| parent | 91ca5303f7ee2aae6935f0b0a3d9fd8f93ca30e7 (diff) | |
Add a helpful-key command
Fixes #14
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | helpful.el | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d10af5..a27be4a 100644 --- 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. @@ -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 |
