[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c71fbbb 03/39: Add option to show docstrings in which-key
From: |
Justin Burkett |
Subject: |
[elpa] master c71fbbb 03/39: Add option to show docstrings in which-key buffer |
Date: |
Thu, 21 Jun 2018 15:48:12 -0400 (EDT) |
branch: master
commit c71fbbbc3ec49bac4b73fe2700d633e3037c7ae4
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>
Add option to show docstrings in which-key buffer
Implements a simple version of the suggestion in #185
---
which-key.el | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/which-key.el b/which-key.el
index 3400491..6ae8b72 100644
--- a/which-key.el
+++ b/which-key.el
@@ -215,6 +215,15 @@ only the first match is used to perform replacements from
:group 'which-key
:type 'boolean)
+(defcustom which-key-show-docstrings nil
+ "If non-nil, show each command's docstring next to the command
+in the which-key buffer. This will only display the docstring up
+to the first line break. You probably also want to adjust
+`which-key-max-description-length' at the same time if you use
+this feature."
+ :group 'which-key
+ :type 'boolean)
+
(defcustom which-key-highlighted-command-list '()
"A list of strings and/or cons cells used to highlight certain
commands. If the element is a string, assume it is a regexp
@@ -1584,14 +1593,24 @@ alists. Returns a list (key separator description)."
(local (eq (which-key--safe-lookup-key local-map (kbd keys))
(intern orig-desc)))
(hl-face (which-key--highlight-face orig-desc))
- (key-binding (which-key--maybe-replace (cons keys orig-desc))))
+ (key-binding (which-key--maybe-replace (cons keys orig-desc)))
+ (final-desc (which-key--propertize-description
+ (cdr key-binding) group local hl-face orig-desc)))
+ (when (and which-key-show-docstrings
+ (commandp (intern orig-desc))
+ (documentation (intern orig-desc)))
+ (setq final-desc
+ (format "%s %s"
+ final-desc
+ (car
+ (split-string
+ (documentation (intern orig-desc)) "\n")))))
(when (consp key-binding)
(push
(list (which-key--propertize-key
(which-key--extract-key (car key-binding)))
sep-w-face
- (which-key--propertize-description
- (cdr key-binding) group local hl-face orig-desc))
+ final-desc)
new-list))))
(nreverse new-list)))
- [elpa] master updated (81c4a3d -> fb09d75), Justin Burkett, 2018/06/21
- [elpa] master 1dd91df 01/39: Implement #182, Justin Burkett, 2018/06/21
- [elpa] master 1219622 02/39: Remove debugging message, Justin Burkett, 2018/06/21
- [elpa] master c71fbbb 03/39: Add option to show docstrings in which-key buffer,
Justin Burkett <=
- [elpa] master fce520f 08/39: Improve which-key--format-and-replace, Justin Burkett, 2018/06/21
- [elpa] master caa18b2 12/39: Fix descriptions of keys involving meta when showing keymaps, Justin Burkett, 2018/06/21
- [elpa] master e5db4b6 07/39: Handle null description in which-key--propertize-description, Justin Burkett, 2018/06/21
- [elpa] master 0aae4c8 04/39: Improve which-key-show-docstrings option, Justin Burkett, 2018/06/21
- [elpa] master 6a4d2c2 09/39: Extract which-key--ignore-keys-regexp and which-key-show-keymap-1, Justin Burkett, 2018/06/21
- [elpa] master ca991b0 11/39: Autoload the show keymap functions, Justin Burkett, 2018/06/21
- [elpa] master fd714bc 13/39: Fix docstring of which-key--get-keymap-bindings, Justin Burkett, 2018/06/21
- [elpa] master b5f7063 15/39: Detect menu-items in which-key--get-keymap-bindings, Justin Burkett, 2018/06/21
- [elpa] master 5493d22 05/39: Fix description truncation when showing docstrings, Justin Burkett, 2018/06/21
- [elpa] master 2e53187 14/39: Fix typo in previous commit, Justin Burkett, 2018/06/21