[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e97253b 24/39: Add prefix arg to which-key--get-current-bi
From: |
Justin Burkett |
Subject: |
[elpa] master e97253b 24/39: Add prefix arg to which-key--get-current-bindings and .. |
Date: |
Thu, 21 Jun 2018 15:48:16 -0400 (EDT) |
branch: master
commit e97253b0523121f15e1a7965e7f4b792e25e2b6c
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>
Add prefix arg to which-key--get-current-bindings and ..
which-key--get-bindings
---
which-key.el | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/which-key.el b/which-key.el
index 4911c4c..2abb529 100644
--- a/which-key.el
+++ b/which-key.el
@@ -1711,9 +1711,9 @@ Requires `which-key-compute-remaps' to be non-nil"
(copy-sequence (symbol-name remap))
binding)))
-(defun which-key--get-current-bindings ()
+(defun which-key--get-current-bindings (&optional prefix)
"Generate a list of current active bindings."
- (let ((key-str-qt (regexp-quote (key-description which-key--current-prefix)))
+ (let ((key-str-qt (regexp-quote (key-description prefix)))
(buffer (current-buffer))
(ignore-bindings '("self-insert-command" "ignore"
"ignore-event" "company-ignore"))
@@ -1724,7 +1724,7 @@ Requires `which-key-compute-remaps' to be non-nil"
(with-temp-buffer
(setq-local indent-tabs-mode t)
(setq-local tab-width 8)
- (describe-buffer-bindings buffer which-key--current-prefix)
+ (describe-buffer-bindings buffer prefix)
(goto-char (point-min))
(let ((header-p (not (= (char-after) ?\f)))
bindings header)
@@ -1739,8 +1739,7 @@ Requires `which-key-compute-remaps' to be non-nil"
((= (char-after) ?\f)
(setq header-p t))
((looking-at "^[ \t]*$"))
- ((or (not (string-match-p ignore-sections-regexp header))
- which-key--current-prefix)
+ ((or (not (string-match-p ignore-sections-regexp header)) prefix)
(let ((binding-start (save-excursion
(and (re-search-forward "\t+" nil t)
(match-end 0))))
@@ -1755,14 +1754,14 @@ Requires `which-key-compute-remaps' to be non-nil"
(cond
((member binding ignore-bindings))
((string-match-p which-key--ignore-keys-regexp key))
- ((and which-key--current-prefix
+ ((and prefix
(string-match (format "^%s[ \t]\\([^ \t]+\\)[ \t]+$"
key-str-qt) key))
(unless (assoc-string (match-string 1 key) bindings)
(push (cons (match-string 1 key)
(which-key--compute-binding binding))
bindings)))
- ((and which-key--current-prefix
+ ((and prefix
(string-match
(format
"^%s[ \t]\\([^ \t]+\\) \\.\\. %s[ \t]\\([^ \t]+\\)[
\t]+$"
@@ -1783,7 +1782,7 @@ Requires `which-key-compute-remaps' to be non-nil"
(forward-line))
(nreverse bindings)))))
-(defun which-key--get-bindings (&optional keymap filter recursive)
+(defun which-key--get-bindings (&optional prefix keymap filter recursive)
"Collect key bindings.
If KEYMAP is nil, collect from current buffer using the current
key sequence as a prefix. Otherwise, collect from KEYMAP. FILTER
@@ -1795,7 +1794,7 @@ non-nil, then bindings are collected recursively for all
prefixes."
(keymap
(error "%s is not a keymap" keymap))
(t
- (which-key--get-current-bindings)))))
+ (which-key--get-current-bindings prefix)))))
(when filter
(setq unformatted (cl-remove-if-not filter unformatted)))
(when which-key-sort-order
@@ -2388,7 +2387,7 @@ is selected interactively by mode in
`minor-mode-map-alist'."
(defun which-key--show-keymap (keymap-name keymap &optional prior-args all)
(setq which-key--current-prefix nil)
(when prior-args (push prior-args which-key--prior-show-keymap-args))
- (let ((bindings (which-key--get-bindings keymap nil all)))
+ (let ((bindings (which-key--get-bindings nil keymap nil all)))
(if (= (length bindings) 0)
(message "which-key: No bindings found in %s" keymap-name)
(cond ((listp which-key-side-window-location)
@@ -2423,7 +2422,8 @@ is selected interactively by mode in
`minor-mode-map-alist'."
(setq which-key--current-prefix nil)
(when (keymapp keymap)
(let ((formatted-keys
- (which-key--get-bindings keymap
#'which-key--evil-operator-filter)))
+ (which-key--get-bindings
+ nil keymap #'which-key--evil-operator-filter)))
(cond ((= (length formatted-keys) 0)
(message "which-key: Keymap empty"))
((listp which-key-side-window-location)
@@ -2454,7 +2454,8 @@ Finally, show the buffer."
(setq which-key--current-prefix prefix-keys
which-key--last-try-2-loc nil)
(let ((start-time (when which-key--debug (current-time)))
- (formatted-keys (which-key--get-bindings from-keymap filter))
+ (formatted-keys (which-key--get-bindings
+ prefix-keys from-keymap filter))
(prefix-keys (key-description which-key--current-prefix)))
(cond ((= (length formatted-keys) 0)
(message "%s- which-key: There are no keys to show" prefix-keys))
- [elpa] master 2e53187 14/39: Fix typo in previous commit, (continued)
- [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, 2018/06/21
- [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 <=
- [elpa] master ded908e 25/39: Remove which-key--current-prefix, Justin Burkett, 2018/06/21
- [elpa] master 013681a 28/39: Fixes related to removal of which-key--current-prefix, Justin Burkett, 2018/06/21
- [elpa] master ff79dff 38/39: Version 3.3.0, Justin Burkett, 2018/06/21
- [elpa] master 4042f06 34/39: Fix prefix bindings in which-key-show-major-mode, Justin Burkett, 2018/06/21
- [elpa] master 0dc4e84 36/39: Use window-size-change-functions for detecting size changes, Justin Burkett, 2018/06/21
- [elpa] master ab60391 21/39: Use cl-struct to hold which-key pages, Justin Burkett, 2018/06/21
- [elpa] master 0b2739a 27/39: Fix display of meta bindings in which-key-show-keymap, Justin Burkett, 2018/06/21
- [elpa] master f77d421 19/39: Consolidate key binding collection into which-key--get-bindings, Justin Burkett, 2018/06/21
- [elpa] master 4370658 29/39: Factor out which-key--this-command-keys function, Justin Burkett, 2018/06/21
- [elpa] master a4095e8 37/39: Fix handling of duplicate (evil) bindings in show keymap, Justin Burkett, 2018/06/21