[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7da9f8c 16/39: Fix which-key--show-keymap when no bidnings
From: |
Justin Burkett |
Subject: |
[elpa] master 7da9f8c 16/39: Fix which-key--show-keymap when no bidnings found |
Date: |
Thu, 21 Jun 2018 15:48:14 -0400 (EDT) |
branch: master
commit 7da9f8caf39cea3895712ce410876b2403d34392
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>
Fix which-key--show-keymap when no bidnings found
which-key--get-formatted-key-bindings takes a nil argument to mean look for
global bindings which is not what we want here.
---
which-key.el | 57 +++++++++++++++++++++++++++++++--------------------------
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/which-key.el b/which-key.el
index 765fd37..818ef17 100644
--- a/which-key.el
+++ b/which-key.el
@@ -2337,32 +2337,37 @@ is selected interactively by mode in
`minor-mode-map-alist'."
(cdr (assq mode-sym minor-mode-map-alist)))))
(defun which-key--show-keymap (keymap-name keymap &optional prior-args all)
- (setq which-key--current-prefix nil
- which-key--current-show-keymap-name keymap-name
- which-key--using-show-keymap t)
- (when prior-args (push prior-args which-key--prior-show-keymap-args))
- (when (keymapp keymap)
- (let ((formatted-keys (which-key--get-formatted-key-bindings
- (which-key--get-keymap-bindings keymap all)
- nil all)))
- (cond ((= (length formatted-keys) 0)
- (message "which-key: Keymap empty"))
- ((listp which-key-side-window-location)
- (setq which-key--last-try-2-loc
- (apply #'which-key--try-2-side-windows
- formatted-keys 0 which-key-side-window-location)))
- (t (setq which-key--pages-plist
- (which-key--create-pages formatted-keys))
- (which-key--show-page 0)))))
- (let* ((key (key-description (list (read-key))))
- (next-def (lookup-key keymap (kbd key))))
- (cond ((and which-key-use-C-h-commands (string= "C-h" key))
- (which-key-C-h-dispatch))
- ((keymapp next-def)
- (which-key--hide-popup-ignore-command)
- (which-key--show-keymap (concat keymap-name " " key) next-def
- (cons keymap-name keymap)))
- (t (which-key--hide-popup)))))
+ (let (unformatted-keys formatted-keys)
+ (setq which-key--current-prefix nil
+ which-key--current-show-keymap-name keymap-name
+ which-key--using-show-keymap t)
+ (when prior-args (push prior-args which-key--prior-show-keymap-args))
+ (if (and (keymapp keymap)
+ (setq unformatted-keys (which-key--get-keymap-bindings keymap
all))
+ ;; need this in two steps otherwise
+ ;; `which-key--get-formatted-key-bindings' will look for global
+ ;; keys if second argument is nil
+ (setq formatted-keys (which-key--get-formatted-key-bindings
+ unformatted-keys nil all))
+ (> (length formatted-keys) 0))
+ (progn
+ (cond ((listp which-key-side-window-location)
+ (setq which-key--last-try-2-loc
+ (apply #'which-key--try-2-side-windows
+ formatted-keys 0
which-key-side-window-location)))
+ (t (setq which-key--pages-plist
+ (which-key--create-pages formatted-keys))
+ (which-key--show-page 0)))
+ (let* ((key (key-description (list (read-key))))
+ (next-def (lookup-key keymap (kbd key))))
+ (cond ((and which-key-use-C-h-commands (string= "C-h" key))
+ (which-key-C-h-dispatch))
+ ((keymapp next-def)
+ (which-key--hide-popup-ignore-command)
+ (which-key--show-keymap (concat keymap-name " " key)
next-def
+ (cons keymap-name keymap)))
+ (t (which-key--hide-popup)))))
+ (message "which-key: No bindings found in %s" keymap-name))))
(defun which-key--evil-operator-filter (binding)
(let ((def (intern (cdr binding))))
- [elpa] master fce520f 08/39: Improve which-key--format-and-replace, (continued)
- [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
- [elpa] master 7da9f8c 16/39: Fix which-key--show-keymap when no bidnings found,
Justin Burkett <=
- [elpa] master 3c05294 26/39: Fix which-key--create-pages, Justin Burkett, 2018/06/21
- [elpa] master adc0d66 06/39: Use safe version of propertize, Justin Burkett, 2018/06/21
- [elpa] master 0f80d0f 17/39: Use symbol at point in whow keymap functions, Justin Burkett, 2018/06/21
- [elpa] master 61e399f 22/39: Add and use which-key--automatic-display, Justin Burkett, 2018/06/21
- [elpa] master 506c348 10/39: Add which-key-show-full-keymap, Justin Burkett, 2018/06/21
- [elpa] master d19fe4e 30/39: Fix switching to top-level from which-key-undo-key, Justin Burkett, 2018/06/21
- [elpa] master 9dc8d32 20/39: Add which-key-toggle-docstrings, Justin Burkett, 2018/06/21
- [elpa] master 206be7a 33/39: Fix behavior of f and t in evil operator map, Justin Burkett, 2018/06/21
- [elpa] master e97253b 24/39: Add prefix arg to which-key--get-current-bindings and .., Justin Burkett, 2018/06/21
- [elpa] master ded908e 25/39: Remove which-key--current-prefix, Justin Burkett, 2018/06/21