Kungsgeten / ryo-modal

Roll your own modal mode
MIT License
222 stars 14 forks source link

repeat not working #37

Closed bodnarlajos closed 3 years ago

bodnarlajos commented 4 years ago

Hi, first of all it is a great stuff, the evil was too much for me ... :) I try to use the ryo-modal-repeat but dont working for a few keys. ("d w" kill-word) -- not okay For the motion keys it is working well ... ("j" next-line) -- okay

I pasted my keybinding because sometimes I found that there is a problem with my keys ... I would have liked to use the (": w" buffer-save) but there was the error like this: ryo-modal-key: Key sequence y l starts with non-prefix key y I got this error with this bindings. Could you clarify what is wrong with it ?

regards Zsome (ryo-modal-keys ("z" ryo-modal-repeat) ("i" ryo-modal-mode) ("," dumb-jump-back) ("." dumb-jump-go) ("q" ryo-modal-mode) ("h" backward-char) ("j" next-line) ("k" previous-line) ("l" forward-char) ("g a" end-of-buffer) ("g e" beginning-of-buffer) ("g j" forward-paragraph) ("g k" backward-paragraph) ("a" beginning-of-line) ("e" end-of-line) ("w" forward-to-word) ("b" backward-word) ;; Editing/marking ("R" query-replace) ("u" undo-tree-undo) ("U" undo-tree-redo) ("x" delete-char) ("d w" kill-word) ("d d" kill-whole-line) ("v" yank) ("r" yank-rectangle) ("m" set-mark-command) ("c" kill-ring-save) ("x" kill-region) ("y l" copy-line))

storvik commented 4 years ago

I have experienced the same problem. Seems like there's a problem with kill commands in ryo-modal-maybe-store-last-command. This is taken from the documentation of variable last-command:

Documentation: The last command executed. Normally a symbol with a function definition, but can be whatever was found in the keymap, or whatever the variable ‘this-command’ was set to by that command.

The value ‘mode-exit’ is special; it means that the previous command read an event that told it to exit, and it did so and unread that event. In other words, the present command is the event that made the previous command exit.

The value ‘kill-region’ is special; it means that the previous command was a kill command.

Therefore this-command is set to kill-region whenever a kill command is used and it's not possible to repeat it.

Not sure how to fix it though.

Kungsgeten commented 4 years ago

Hi! For me I get no problem with using y l as a key sequence. I'm not sure why : w would be a problem (unless you've already bound : itself to something else).

Thanks to @storvik for pointing out this-command and the kill-region stuff. I didn't know that. I've now changed how ryo-modal-maybe-store-last-command works, and hopefully it doesn't break anything :) Seems to work with the testing I've done.

storvik commented 4 years ago

Thank you @Kungsgeten. Keep up the good work!

Kungsgeten commented 3 years ago

Closing this because of inactivity, and also because I believe it is fixed.