You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be a case of misunderstanding the way to use Meow, but I can't find the right settings to make this work as intended.
For discussion, assume I want SPC . to always call find-file. I can do that by using (meow-leader-define-key '("." . find-file))
or equivalently I can use (bind-keys :map mode-specific-map ("." . find-file))
I would like SPC . to always call find-file, even in major-modes that overwrite that binding, such as in org-mode where C-c . is bound to org-timestamp. Now the trick is that I would like the fallback when a key isn't found in the leader keymap to be C-c <key>, so if I hit SPC / while in org-mode, it should call org-sparse-tree. However, if I use (setq meow-keypad-leader-dispatch "C-c"), then I lose the find-file functionality on SPC ..
I also realize that I can get most of what I want by just hitting SPC c <key> but I wasn't sure if there is something else I'm missing about getting this set right.
Also note I got a solution of sorts from an LLM but again I'd prefer this to work as intended if its built in.
(defun my/meow--leader-dispatch-keymap ()
"A keymap for `meow-keypad-leader-dispatch' where my own
`mode-specific-map' bindings take precedence over whatever the
current major/minor mode has locally bound to C-c."
(let ((local-cc-map (key-binding (kbd "C-c"))))
(if (and (keymapp local-cc-map)
(not (eq local-cc-map mode-specific-map)))
(make-composed-keymap mode-specific-map local-cc-map)
mode-specific-map)))
(defun my/meow-refresh-leader-dispatch ()
(setq-local meow-keypad-leader-dispatch (my/meow--leader-dispatch-keymap)))
;; Recompute every time keypad state is entered, so it's always
;; current for whatever major/minor modes are active right now.
(add-hook 'meow-keypad-mode-hook #'my/meow-refresh-leader-dispatch)
Edit:
I also found this discussion which seems to be the answer unless things have changed in 5 years: #126 (comment)
My issue is more about how to handle cases where major-modes overwrite my commands in mode-specific-map.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This might be a case of misunderstanding the way to use Meow, but I can't find the right settings to make this work as intended.
For discussion, assume I want
SPC .to always callfind-file. I can do that by using(meow-leader-define-key '("." . find-file))or equivalently I can use
(bind-keys :map mode-specific-map ("." . find-file))I would like
SPC .to always callfind-file, even in major-modes that overwrite that binding, such as in org-mode whereC-c .is bound toorg-timestamp. Now the trick is that I would like the fallback when a key isn't found in the leader keymap to beC-c <key>, so if I hitSPC /while in org-mode, it should callorg-sparse-tree. However, if I use(setq meow-keypad-leader-dispatch "C-c"), then I lose thefind-filefunctionality onSPC ..I also realize that I can get most of what I want by just hitting
SPC c <key>but I wasn't sure if there is something else I'm missing about getting this set right.Also note I got a solution of sorts from an LLM but again I'd prefer this to work as intended if its built in.
Edit:
I also found this discussion which seems to be the answer unless things have changed in 5 years:
#126 (comment)
My issue is more about how to handle cases where major-modes overwrite my commands in mode-specific-map.
Beta Was this translation helpful? Give feedback.
All reactions