Skip to content

Commit

Permalink
which-key replacements: Handle :definer 'minor-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
leifhelm committed Jul 29, 2021
1 parent f230a55 commit 1efda23
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions general.el
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,14 @@ the other hand, doesn't make sense at all globally.")
;; *** Which Key Integration

;; TODO better documentation
(defun general-extended-def-:which-key (state keymap key edef _kargs)
(defun general-extended-def-:which-key (state keymap key edef kargs)
"Add a which-key description for KEY.
KEY should not be in the kbd format (kbd should have already been run on it)."
(general-with-eval-after-load 'which-key
(let ((wk (general--getf2 edef :which-key :wk))
(key (key-description key))
(keymap (general--get-keymap state keymap)))
(let* ((wk (general--getf2 edef :which-key :wk))
(key (key-description key))
(minor-mode (eq 'minor-mode (cl-getf kargs :definer)))
(keymap (general--get-keymap state keymap minor-mode)))
(which-key-add-keymap-based-replacements keymap key wk))))

(defalias 'general-extended-def-:wk #'general-extended-def-:which-key)
Expand Down

0 comments on commit 1efda23

Please sign in to comment.