Skip to content

implement which-key keymap based replacements#481

Open
jgrey4296 wants to merge 3 commits intonoctuid:masterfrom
jgrey4296:master
Open

implement which-key keymap based replacements#481
jgrey4296 wants to merge 3 commits intonoctuid:masterfrom
jgrey4296:master

Conversation

@jgrey4296
Copy link
Copy Markdown

this replaces the use of which-key-replacement-alist with the newer keymap-based-replacement approach of which-key.
It also enables evil-state based which-key bindings.

@leifhelm
Copy link
Copy Markdown

I have a configuration like this:

  (general-create-definer leader-keys
    :states '(normal insert visual emacs)
    :prefix "SPC"
    :global-prefix "C-SPC")

  (leader-keys
    "TAB" '(evil-switch-to-windows-last-buffer :which-key "Last buffer"))

It creates a message when i press SPC in normal mode:
Error running timer ‘which-key--update’: (wrong-type-argument listp "Last buffer")
And it does not display any replacements.

(replacement (cond ((consp wk) (cdr wk))
(t wk)))
;; check the map exists, if not, try adding -map to it. (ie: global -> global-map)
(real-keymap (if (boundp keymap) (symbol-value keymap) (symbol-value (intern (format "%s-map" keymap)))))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(real-keymap (if (boundp keymap) (symbol-value keymap) (symbol-value (intern (format "%s-map" keymap)))))
(real-keymap (general--get-keymap nil keymap nil t)))

Have a look at general--get-keymap. I found it while browsing general--define-key-dispatch

dramatically speeds up boot time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants