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

Make god-mode work in special-mode buffers such as the Org agenda #3

Closed
wants to merge 1 commit into from
Closed

Conversation

spwhitton
Copy link

god-mode doesn't work well in special-mode buffers such as the Org agenda. These buffers bind functions other than self-insert-command to letter and number keys, and god-local-mode intercepts key presses by remapping self-insert-command to its own function. So it fails to get a grip in special-mode buffers.

This is okay when one isn't using Evil, because in such modes bindings aren't generally prefixed with C- and M-, so there's little reason to use god-mode.

However, it's useful, at least in my own case, to use evil-god-state from the Emacs state in Org agenda buffers. So manually remap all the single character keys to god-mode-self-insert-command.

agenda.  These buffers bind functions other than `self-insert-command`
to letter and number keys, and god-local-mode intercepts key presses by
remapping `self-insert-command` to its own function.  So it fails to get
a grip in special-mode buffers.

This is okay when one isn't using Evil, because in such modes bindings
aren't generally prefixed with C- and M-, so there's little reason to
use god-mode.

However, it's useful, at least in my own case, to use evil-god-state
from the Emacs state in Org agenda buffers.  So manually remap all the
single character keys to `god-mode-self-insert-command`.
@gridaphobe
Copy link
Owner

Hey, sorry I keep forgetting to respond to this. I don't particularly like adding a hard-coded list of keys to override, particularly when it will be run for all buffers. So I'd prefer not to merge this in at the moment, but that doesn't mean you have to keep using a fork!

Just add a hook to evil-god-state-entry-hook, e.g.

(defun my-override-special-mode-keys ()
  ...
)
(add-hook 'evil-god-state-entry-hook my-override-special-mode-keys)

@spwhitton
Copy link
Author

Thanks. I'm achieving the same thing in my own config by just adding the keys to god-local-mode-map. I totally understand why you don't want to merge this; I wish I could come up with a better way. Perhaps scanning all current bindings for those preceding with C- and M- and then binding those.

@spwhitton spwhitton closed this Nov 17, 2014
shadowrylander pushed a commit to syvlorg/aiern-god-state that referenced this pull request Jun 29, 2021
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

Successfully merging this pull request may close these issues.

2 participants