aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Burkett2019-07-23 11:52:11 -0400
committerJustin Burkett2019-07-23 11:52:11 -0400
commitda2e093e916bf9ae7512c104512b92eca8fb224e (patch)
tree0ebb1b679c22fd3b4fb8bc79d230c8b9c470157e
parentcf8572a6888547451e6af461b374f3a5fde28f5d (diff)
downloademacs-da2e093e916bf9ae7512c104512b92eca8fb224e.tar.gz
emacs-da2e093e916bf9ae7512c104512b92eca8fb224e.zip
Add no-paging optional arg to which-key-show-keymap
-rw-r--r--which-key.el32
1 files changed, 19 insertions, 13 deletions
diff --git a/which-key.el b/which-key.el
index 1d3c21d711f..c47c576e55e 100644
--- a/which-key.el
+++ b/which-key.el
@@ -2429,12 +2429,16 @@ Only if no bindings fit fallback to LOC2."
2429 'which-key-keymap-history))) 2429 'which-key-keymap-history)))
2430 2430
2431;;;###autoload 2431;;;###autoload
2432(defun which-key-show-keymap (keymap) 2432(defun which-key-show-keymap (keymap &optional no-paging)
2433 "Show the top-level bindings in KEYMAP using which-key. KEYMAP 2433 "Show the top-level bindings in KEYMAP using which-key. KEYMAP
2434is selected interactively from all available keymaps." 2434is selected interactively from all available keymaps.
2435
2436If NO-PAGING is non-nil, which-key will not intercept subsequent
2437keypresses for the paging functionality."
2435 (interactive (list (which-key--read-keymap))) 2438 (interactive (list (which-key--read-keymap)))
2436 (which-key--show-keymap (symbol-name keymap) 2439 (which-key--show-keymap (symbol-name keymap)
2437 (symbol-value keymap))) 2440 (symbol-value keymap)
2441 nil nil no-paging))
2438 2442
2439;;;###autoload 2443;;;###autoload
2440(defun which-key-show-full-keymap (keymap) 2444(defun which-key-show-full-keymap (keymap)
@@ -2464,7 +2468,8 @@ is selected interactively by mode in `minor-mode-map-alist'."
2464 (which-key--show-keymap (symbol-name mode-sym) 2468 (which-key--show-keymap (symbol-name mode-sym)
2465 (cdr (assq mode-sym minor-mode-map-alist))))) 2469 (cdr (assq mode-sym minor-mode-map-alist)))))
2466 2470
2467(defun which-key--show-keymap (keymap-name keymap &optional prior-args all) 2471(defun which-key--show-keymap
2472 (keymap-name keymap &optional prior-args all no-paging)
2468 (when prior-args (push prior-args which-key--prior-show-keymap-args)) 2473 (when prior-args (push prior-args which-key--prior-show-keymap-args))
2469 (let ((bindings (which-key--get-bindings nil keymap nil all))) 2474 (let ((bindings (which-key--get-bindings nil keymap nil all)))
2470 (if (= (length bindings) 0) 2475 (if (= (length bindings) 0)
@@ -2477,15 +2482,16 @@ is selected interactively by mode in `minor-mode-map-alist'."
2477 (t (setq which-key--pages-obj 2482 (t (setq which-key--pages-obj
2478 (which-key--create-pages bindings nil keymap-name)) 2483 (which-key--create-pages bindings nil keymap-name))
2479 (which-key--show-page))) 2484 (which-key--show-page)))
2480 (let* ((key (key-description (list (read-key)))) 2485 (unless no-paging
2481 (next-def (lookup-key keymap (kbd key)))) 2486 (let* ((key (key-description (list (read-key))))
2482 (cond ((and which-key-use-C-h-commands (string= "C-h" key)) 2487 (next-def (lookup-key keymap (kbd key))))
2483 (which-key-C-h-dispatch)) 2488 (cond ((and which-key-use-C-h-commands (string= "C-h" key))
2484 ((keymapp next-def) 2489 (which-key-C-h-dispatch))
2485 (which-key--hide-popup-ignore-command) 2490 ((keymapp next-def)
2486 (which-key--show-keymap (concat keymap-name " " key) next-def 2491 (which-key--hide-popup-ignore-command)
2487 (cons keymap-name keymap))) 2492 (which-key--show-keymap (concat keymap-name " " key) next-def
2488 (t (which-key--hide-popup))))))) 2493 (cons keymap-name keymap)))
2494 (t (which-key--hide-popup))))))))
2489 2495
2490(defun which-key--evil-operator-filter (binding) 2496(defun which-key--evil-operator-filter (binding)
2491 (let ((def (intern (cdr binding)))) 2497 (let ((def (intern (cdr binding))))