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

Use of devil when the modifier is in the middle of a keybinding #18

Open
wesnel opened this issue Oct 24, 2023 · 2 comments
Open

Use of devil when the modifier is in the middle of a keybinding #18

wesnel opened this issue Oct 24, 2023 · 2 comments
Labels
question Further information is requested

Comments

@wesnel
Copy link

wesnel commented Oct 24, 2023

I apologize if the title of this issue is confusing, but hopefully an example will illustrate what I mean:

Is there a way for me to trigger keybindings such as <f1> C-a using devil? Currently, typing <f1> , will result in the error <f1> , is undefined rather than activating the devil prompt.

Instead, I would like to be able to do <f1> , a and have devil translate that to <f1> C-a.

Thanks!

@susam susam added the question Further information is requested label Oct 24, 2023
@susam
Copy link
Owner

susam commented Oct 24, 2023

Sorry, this type of translation is not supported by Devil. The reason is that the devil-key (which is , by default) is an actual key binding that runs a command named devil which then reads a Devil key sequence and translates it to Emacs key sequences and commands.

Since <f1> , represents a completely different key sequence under the <f1> prefix, Devil does not get a chance to run when this key sequence is typed.

I believe a workaround for this could be to type , h , a instead.

@wesnel
Copy link
Author

wesnel commented Oct 25, 2023

Thanks for the fast response @susam. That's what I suspected.

Did you experiment with different approaches for implementing devil? The , keybinding approach is elegant and makes sense. However, I'm trying to learn more about Emacs, and I was interested in knowing if it were possible to implement devil by instead advising a function like this-single-command-keys. I imagine that it could be possible to handle the edge case I described in this issue if we were always able to "intercept" the most recent key, but I'm sure this approach could add complexity. I was just curious! Thanks for your time.

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

No branches or pull requests

2 participants