Omit undefined/disable keybinds in which-key

This is for commands in disabled modules. This does not disable their
keybinds, but it stops them from showing up in which-key.
This commit is contained in:
Henrik Lissner 2018-08-26 16:38:35 +02:00
parent 1ed8894826
commit d8fa5f39ad
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -180,6 +180,14 @@ shorter major mode name in the mode-line. See `doom|set-mode-name'.")
(+ (if (boundp 'display-line-numbers) 6 0) (+ (if (boundp 'display-line-numbers) 6 0)
fill-column)) fill-column))
(defun doom*hide-undefined-which-key-binds (bindings)
(cl-loop for bind in bindings
if (or (member (cdr bind) '("Prefix Command" "??"))
(fboundp (intern (cdr bind))))
collect bind))
(advice-add #'which-key--get-current-bindings :filter-return #'doom*hide-undefined-which-key-binds)
(advice-add #'which-key--get-keymap-bindings :filter-return #'doom*hide-undefined-which-key-binds)
;; ;;
;; Built-in packages ;; Built-in packages