[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/which-key 4e592ed 08/32: Fix type usage and arglists fo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/which-key 4e592ed 08/32: Fix type usage and arglists for new functions |
Date: |
Wed, 30 Jun 2021 18:57:27 -0400 (EDT) |
branch: externals/which-key
commit 4e592ed7b913aecd13ce8d4e316ca4f8e2f34d7c
Author: Justin Burkett <justin@burkett.cc>
Commit: Justin Burkett <justin@burkett.cc>
Fix type usage and arglists for new functions
---
which-key.el | 62 ++++++++++++++++++++++++++++++++----------------------------
1 file changed, 33 insertions(+), 29 deletions(-)
diff --git a/which-key.el b/which-key.el
index bb1cf01..d6baa70 100644
--- a/which-key.el
+++ b/which-key.el
@@ -1399,8 +1399,7 @@ Uses `string-lessp' after applying lowercase."
(string-lessp (downcase (cdr acons)) (downcase (cdr bcons))))
(defsubst which-key--group-p (description)
- (or (string-match-p "^\\(group:\\|Prefix\\)" description)
- (keymapp (intern description))))
+ (keymapp (intern description)))
(defun which-key-prefix-then-key-order (acons bcons)
"Order first by whether A and/or B is a prefix with no prefix
@@ -1739,19 +1738,19 @@ alists. Returns a list (key separator description)."
Requires `which-key-compute-remaps' to be non-nil"
(let (remap)
(if (and which-key-compute-remaps
- (setq remap (command-remapping (intern binding))))
+ (setq remap (command-remapping binding)))
(copy-sequence (symbol-name remap))
(copy-sequence (symbol-name binding)))))
(defun which-key--get-keymap-bindings-1
- "Helper function for `which-key--get-keymap-bindings'"
- (keymap start &optional prefix all ignore-commands)
+ (keymap start &optional prefix filter all ignore-commands)
+ "See `which-key--get-keymap-bindings'."
(let ((bindings start)
(prefix-map (if prefix (lookup-key keymap prefix) keymap)))
(when (keymapp prefix-map)
(map-keymap
(lambda (ev def)
- (let* ((key (append prefix (list ev)))
+ (let* ((key (vconcat prefix (list ev)))
(key-desc (key-description key)))
(cond
((assoc key-desc bindings))
@@ -1768,25 +1767,29 @@ Requires `which-key-compute-remaps' to be non-nil"
(and (numberp ev) (= ev 27))))
(setq bindings
(which-key--get-keymap-bindings-1
- keymap bindings key all ignore-commands)))
+ keymap bindings key nil all ignore-commands)))
(def
- (push
- (cons key-desc
- (cond
- ((keymapp def) "+prefix")
- ((symbolp def) (which-key--compute-binding def))
- ((eq 'lambda (car-safe def)) "lambda")
- ((eq 'menu-item (car-safe def))
- (keymap--menu-item-binding def))
- ((stringp def) def)
- ((vectorp def) (key-description def))
- ((consp def) (car def))
- (t "unknown")))
- bindings)))))
+ (let ((binding
+ (cons key-desc
+ (cond
+ ((keymapp def) "prefix")
+ ((symbolp def) (which-key--compute-binding def))
+ ((eq 'lambda (car-safe def)) "lambda")
+ ((eq 'menu-item (car-safe def))
+ (keymap--menu-item-binding def))
+ ((stringp def) def)
+ ((vectorp def) (key-description def))
+ ((consp def) (car def))
+ (t "unknown")))))
+ (when (or (null filter)
+ (and (functionp filter)
+ (funcall filter binding)))
+ (push binding bindings)))))))
prefix-map))
bindings))
-(defun which-key--get-keymap-bindings (keymap &optional prefix start all evil)
+(defun which-key--get-keymap-bindings
+ (keymap &optional start prefix filter all evil)
"Retrieve top-level bindings from KEYMAP.
PREFIX limits bindings to those starting with this key
sequence. START is a list of existing bindings to add to. If ALL
@@ -1799,16 +1802,18 @@ EVIL is non-nil, extract active evil bidings."
(lookup-key keymap (kbd (format "<%s-state>" evil-state))))))
(when (keymapp evil-map)
(setq bindings (which-key--get-keymap-bindings-1
- evil-map bindings prefix all ignore)))
- (which-key--get-keymap-bindings-1 keymap bindings prefix all ignore)))
+ evil-map bindings prefix filter all ignore)))
+ (which-key--get-keymap-bindings-1
+ keymap bindings prefix filter all ignore)))
-(defun which-key--get-current-bindings (&optional prefix)
+(defun which-key--get-current-bindings (&optional prefix filter)
"Generate a list of current active bindings."
(let (bindings)
(dolist (map (current-active-maps t) bindings)
(when (cdr map)
(setq bindings
- (which-key--get-keymap-bindings map prefix bindings))))))
+ (which-key--get-keymap-bindings
+ map bindings prefix filter))))))
(defun which-key--get-bindings (&optional prefix keymap filter recursive)
"Collect key bindings.
@@ -1818,13 +1823,12 @@ is a function to use to filter the bindings. If
RECURSIVE is
non-nil, then bindings are collected recursively for all prefixes."
(let* ((unformatted
(cond ((keymapp keymap)
- (which-key--get-keymap-bindings keymap recursive))
+ (which-key--get-keymap-bindings
+ keymap prefix filter recursive))
(keymap
(error "%s is not a keymap" keymap))
(t
- (which-key--get-current-bindings prefix)))))
- (when filter
- (setq unformatted (cl-remove-if-not filter unformatted)))
+ (which-key--get-current-bindings prefix filter)))))
(when which-key-sort-order
(setq unformatted
(sort unformatted which-key-sort-order)))
- [elpa] externals/which-key 27d9fec 32/32: Fix compiler warnings, (continued)
- [elpa] externals/which-key 27d9fec 32/32: Fix compiler warnings, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 4c27fc0 30/32: Improve which-key-add-keymap-based-replacements., ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 8a558e6 06/32: Update tests, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key e42d946 11/32: Fix prefix sorting, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key fc88551 05/32: Remove pseudo binding stuff, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 465d2fb 10/32: Fix add-keymap-based-bindings and associated test, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 6ae80f5 22/32: Try without cask, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key d621634 19/32: Try with cask again, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key a55b908 04/32: Alternative approach to retrieving bindings (WIP), ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 1f9c37d 03/32: Merge pull request #305 from tarsiiformes/first-line, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 4e592ed 08/32: Fix type usage and arglists for new functions,
ELPA Syncer <=
- [elpa] externals/which-key d6b56f3 13/32: Fix detection of named prefix bindings, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 2444833 12/32: Fix menu-item bidning retrieval, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 7d344ce 17/32: Fix test, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 300c098 16/32: Update README, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 3f76f51 20/32: Fix which-key--group-p, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 8b707ef 15/32: Make enable-extended-define-key obsolete, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key b83c0de 27/32: Clean up which-key--maybe-replace, ELPA Syncer, 2021/06/30
- [elpa] externals/which-key 7abe54f 31/32: Handle closure definition type, ELPA Syncer, 2021/06/30