evil mode shadows simple-mpc-mode-map
Closed this issue · 6 comments
Hello! I really like this interface for mpc.
If your emacs config contains the following, none of the bindings in simple-mpc-mode work.
(require 'evil)
(evil-mode 1)
(require 'simple-mpc)
If you use describe-mode
(C-h m
) from withing simple-mpc-mode, you'll see that all of the simple-mpc
commands are "shadowed by another mode." For example:
s simple-mpc-query
(that binding is currently shadowed by another mode)
t simple-mpc-toggle
(that binding is currently shadowed by another mode)
v simple-mpc-decrease-volume
(that binding is currently shadowed by another mode)
Ideally, I'd like to use the basic evil
movement keys (which aren't bound to anything special in simple-mpc-mode-map
). I'm not quite experienced enough with elisp to figure this out.
Also, even if I turn off evil mode, I'm still unable to use RET
or S-RET
to invoke simple-mpc-query-add
or simple-mpc-query-add-and-play
in simple-mpc-query-mode
. Bindings for those two commands do not appear in the describe mode
*Help*
buffer at all (shadowed or not).
Thank you!!
Hi, I tried but can't reproduce the problems you're having. It's true that Evil will shadow all the bindings. It binds almost every key so you can navigate in normal mode (the mode after pressing ESC). Switching to insert mode (by pressing i) allows you to interact with simple-mpc as if you were weren't using Evil.
simple-mpc-query-add
and simple-mpc-query-add-and-play
are only bound in the simple-mpc-query-mode
minor mode as you mentioned. You can get there by either pressing s
after executing simple-mpc
or by M-x simple-mpc-query
. After entering your search query you're dropped into a buffer with simple-mpc-query-mode
enabled. The keybindings should be available there.
Let me know if anything is still unclear.
Thank you for your response! I hadn't thought to try switching to insert mode, which does solve the problem given the config in my prior comment. To avoid having to press i
each time, I can have evil start in insert mode in simple-mpc-mode:
(require 'evil)
(evil-set-initial-state 'simple-mpc-mode 'insert)
(evil-mode 1)
(require 'simple-mpc)
However... there is a quirk with evil-collection, as with this config:
(setq evil-want-keybinding nil) ;; Required for evil-collection
(require 'evil)
(evil-mode 1)
(require 'evil-collection)
(evil-collection-init)
(require 'simple-mpc)
Now upon entering simple-mpc-mode, you'll be in evil mode's normal state but the bindings to enter insert state are unbound. i
, a
, o
, O
are all bound to ignore
. I didn't test any other keys. You can still enter insert state with M-x evil-insert
, after which simple-mpc-mode works great, but it's a bit tedious.
A better solution is to add (evil-set-initial-state 'simple-mpc-mode 'insert)
to the config and simple-mpc works flawlessly so long as I don't enter normal state by pressing <escape>
.
I'm not sure what's causing the bindings to enter insert state to become unbound.
Regarding the second issue from my first comment concerning simple-mpc-query-mode. Given this config:
(setq evil-want-keybinding nil) ;; Required for evil-collection
(require 'evil)
(evil-set-initial-state 'simple-mpc-mode 'insert)
(evil-mode 1)
(require 'evil-collection)
(evil-collection-init)
(require 'simple-mpc)
After M-x simple-mpc-query
(or M-x simple-mpc RET s
), I type any RET Pink Floyd RET
, and I see a list of search results.
However, when I try to queue up a song with RET
or S-RET
, I get this message:
Buffer is read-only: #<buffer *simple-mpc-query*>
Invoking M-x simple-mpc-query-add
and M-x simple-mpc-query-add-and-play
work flawlessly, but it would be nice to have access to the keybindings.
Do you have any suggestions?
This issue will be resolved with this PR.
I just tried using RET
in simple-mpc-query-mode
and it works fine in normal mode using evil. I tested without evil-collection and without any config, just launching evil with M-x evil-mode
. Perhaps there's something else in your config that's causing this? Maybe evil-collection?
Thank you, this suggestion solved the problem.