Skip to content
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

Binding for C-x and M-x? #28

Open
EivindSt opened this issue Sep 28, 2019 · 7 comments
Open

Binding for C-x and M-x? #28

EivindSt opened this issue Sep 28, 2019 · 7 comments

Comments

@EivindSt
Copy link

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)"

@Kungsgeten
Copy link
Owner

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

@EivindSt
Copy link
Author

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.

@jkopanski
Copy link

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.

@Kungsgeten
Copy link
Owner

@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))

@jkopanski
Copy link

@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

@Kungsgeten
Copy link
Owner

Kungsgeten commented Oct 7, 2020

@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")))

@jkopanski
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants