Kungsgeten / ryo-modal

Roll your own modal mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binding for C-x and M-x?

EivindSt opened this issue · comments

I tried to bind C-x but it doesn't seem to work.

E.g. the following:

(ryo-modal-keys
  ("c" "C-x")
)

will cause Emacs to enter C-x when it is first opened, but trying to enter it in ryo-modal mode gives the following error:
"Wrong type argument: commandp, (24)"

I think it should be fixed now. Unfortunately I couldn't get it to work with longer key sequences...

Hi again and apologies for the late response.

With the latest version, I am still getting the same results (and error) as earlier.
The config is:

(use-package ryo-modal
  :commands ryo-modal-mode
  :bind ("C-ø" . ryo-modal-mode)
  :config
  (ryo-modal-keys
   ("c" "C-x")
;; ...

I have however transitioned to using Hydra instead to achieve some modal functions, so you may close this issue if you wish.

Hi!

I've hit this issue while trying to set key for an s-l (in order to match lsp-mode prefix).

What I've discovered is that I am getting this error, while setting modal key to something which don't have any function assigned to that key, for example M-p or M-n in my case.

I have no trouble binding keys for M-x or other combinations which already have some action bound to them.

@jkopanski So you have something like ("s-l" lsp-mode) in your ryo-keys? For me the following works without issue, even though I M-p is undefined by default:

(ryo-modal-keys
 ("M-p" previous-line))

@Kungsgeten no, the other way around.

lsp-mode sets s-l to lsp-command-map[1], so I wanted to set it with ryo like:

(ryo-modal-keys
  ("c" "s-l"))

But it fails with Symbol’s function definition is void: nil. So I guess this is more like #31

So I wanted to try some other chord, and discovered that if the target chord is undefined, ryo will fail with that message.

[1] The reason that I didn't assigned lsp-command-map directly is that it isn't a function but a variable. Yet it is assigning it is recommended way by upstream

@jkopanski I see! I seldom use the feature of letting the "target" be a string, so I haven't tested it much with cases like this. When you're setting the target to "s-l" it looks for the command bound to that binding. My guess is that in your config lsp-mode haven't been loaded yet. You could try:

(with-eval-after-load 'lsp-mode
  (ryo-modal-keys
   ("c" "s-l")))

When you're setting the target to "s-l" it looks for the command bound to that binding.

That explains a lot. I've assumed it worked like modalka where it would just emit s-l.

Unfortunately your snippet fails with the same error.

I'm using use-package to configure my packages and both :ryo integration and putting it in :config (which should be run after load as well) fails with the same error.