-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add handling for meow-keypad-self-insert-undefined #700
base: master
Are you sure you want to change the base?
Conversation
I also noticed there is something weird going on with undo when doing keypad self insert. |
By using meow--keypad-execute it allows for running self-insert-command on beacons. Due to self-insert-command not placing a undo-boundry before this point, explicitly place a boundry before executing the command.
I've fixed the issue where the command wasn't run on beacons, and also added an undo boundary before running it. |
Filtering on this is no longer necessary.
At this point I believe the keypad works the same for self insertions as it did before the refactor, with the exception that you can now explicitly set self insertions in the keypad map instead of having the variable toggle it for all unbound keys. |
I think we have to be caution about this change, it may break things. |
Sounds reasonable. Is there anything in particular that you are worried about? |
We can't set |
I'm thinking maybe we can achieve the goal with another method. If users want to call self-insert-command in a specific use case. |
Can you elaborate on what you mean? Do you mean instead of setting |
Ok, so after thinking a bit more about this I am
(setq last-command-event (aref (kbd (meow--keypad-format-keys)) 0)) This also makes me a bit uncertain |
This sets the last-command-event properly with a correctly formated key.
I see I made some more incorrect assumptions in my first solution. This allows the self-insert to work like it did (probably mostly by accident) before, but also with repeat maps. |
Maybe we should patch last-command-event and last-input-event together? How do you think? |
Yes you're right, we should also make sure that the last-input-event is correct. I also think we should wait as long as we can until we set last-command-event, and not set it when we are not executing a command. After some thinking about it I think we could set last-input-event in Then I think we should move setting last-command-event into |
Why we need a undo boundary? |
Without the boundary it won't add one when doing self-insert. There was a boundary placed there automatically before the refactor, and this is also the behavior I observe when binding the self-insert explicitly in the keypad map. |
In beacon, we collapse the boundary so that the whole kmacro application can be reverted in one undo. |
I'm also thinking is there a way to achieve this, at the same time, remove the need on binding |
I haven't looked much into how the key rebinding to H-* is done. Are you thinking that it will work the same way as any other key to key rebinding, (meow-leader-define-key
'("L" . "H-L") ;Bind 'L' to gain access to overriden key in motion.
'("p" . "C-x p") ;Bind 'p' for easy project menu.
) Are we doing some special magic now instead of just sending H-L? Edit: |
Sorry for my slow progress on this, I have some thoughts about a better way to achieve the same goal. The way this PR works is to call a |
Ah, I see. That sounds like a good way of doing it. So an unbound key in the keypad would bypass the current meow state and call the current key map instead. The only issue I can see is that it would be less obvious how to handle key conflicts in motion state. Currently you handle a conflict by explicitly binding something in the keypad to H-*. This is mostly a problem that can be solved with documentation. It would be nice if we also had some explicit way of binding it as well, something like: |
Please try this #705 and see if it works for you. |
This doesn't fully solve the problem as it doesn't get applied to beacons as expected.
May be due to setting
last-command-event
with a let so it doesn't persist?It does make it possible to self-insert using the keypad like before.
As it sets
last-command-event
calling prefix arg from keypad also works as expected.It is now also possible to set
meow-keypad-self-insert-undefined
to nil and bindself-insert-command
in keypad.