-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
customized prefix-help-command does not work when C-h is invoked after which-key popup is displayed #3
Comments
I realized one thing : that Does anyone have any suggestion to support searching for target command when the keymap displayed by which-key is very densely populated? |
@mbkamble Just saw this after several years while submitting a new PR, not sure if still issue for you. Here's a macro I came up with to stick (cl-defmacro my/hercules-maps-helper ( show-funs keymap flatten
&rest hercules-def-args)
"Create `hercules' pop-up map. This is basically same as using `hercules-def'
directly, but I moved the three keys I use most SHOW-FUNS, KEYMAP and FLATTEN to
first three parameters. This way I don't need to be as verbose on creating. Add
the other parameters by passing HERCULES-DEF-ARGS with same keys from
`hercules-def'. This also adds an `embark' action \"C-.\" to list all keys when
larger list of keys: (> (length MAP) 20)."
(let ((which-key-sort-order nil)
(toggle-funs `'(,@(plist-get hercules-def-args :toggle-funs)))
(transient (plist-get hercules-def-args :transient))
(blacklist-keys (plist-get hercules-def-args :blacklist-keys))
(whitelist-keys (plist-get hercules-def-args :whitelist-keys))
(blacklist-funs (plist-get hercules-def-args :blacklist-funs))
(whitelist-funs (plist-get hercules-def-args :whitelist-funs))
(package (plist-get hercules-def-args :package))
(hide-funs `'(keyboard-quit
read-from-minibuffer
embark-bindings-in-keymap
,@(plist-get hercules-def-args :hide-funs)))
(map-sym (intern (format "my/hercules-helper-map-%s" keymap))))
`(progn
(setq ,map-sym (make-sparse-keymap))
;; (unless (string= (symbol-name ,show-funs) "my/show-hercules-maps")
;; (keymap-set ,map-sym "H-z" #'my/show-hercules-maps))
(when (> (length ,keymap) 20)
;; Remind at top about using Embark bindings
(keymap-set ,map-sym
"C-."
'("++Embark Keys!++" .
(lambda ()
"Show all keybinds for this keymap in Embark listing."
(interactive)
(unwind-protect
(embark-bindings-in-keymap ,keymap)
(call-interactively ,show-funs))))))
;; Add these together.
(set-keymap-parent ,map-sym ,keymap)
(hercules-def
:toggle-funs ,toggle-funs
:show-funs ,show-funs
:hide-funs ,hide-funs
:keymap ',map-sym
:flatten ,flatten
:transient ,transient
:blacklist-keys ,blacklist-keys
:whitelist-keys ,whitelist-keys
:blacklist-funs ,blacklist-funs
:whitelist-funs ,whitelist-funs
:package ,package)))) Then as example, here's how I create the hercules map edebug with above macro: (require 'edebug)
(with-eval-after-load 'edebug
(my/hercules-maps-helper #'my/hercules-edebug-commands edebug-mode-map t
:toggle-funs (edebug-mode)
:hide-funs (edebug-help)) ;;"?"
(keymap-set emacs-lisp-mode-map "H-z d" '("edebug-mode" . my/hercules-edebug-commands))) |
I am trying to use
embark-prefix-help-command
(fromembark
package) as the choice for C-h when which-key pop-up contains too many bindings.These are the configurations I use for these packages:
Then if I visit an org file such as README.org, and press
C-c
, wait for the which-key popup and then pressC-h
, I get the completing-read functionality ofembark-prefix-help-command
. But if I doC-c C-v
and thenC-h
, it showswhich-key-C-h-map
bindings where then -> next-page, p -> previous-page, etc
are displayed.How do I fix this, so that C-h uses embark-prefix-help-command even for hercules?
The text was updated successfully, but these errors were encountered: