Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Workaround for evil-collection-inhibit-insert-state #443

Closed
bwetherfield opened this issue Jan 17, 2021 · 7 comments
Closed

Workaround for evil-collection-inhibit-insert-state #443

bwetherfield opened this issue Jan 17, 2021 · 7 comments

Comments

@bwetherfield
Copy link

Hello! Thanks for a great package - makes me feel right at home, coming from vim.

I have noticed that evil-collection enforces a keybinding of ignore for anything that would enter insert mode from a view-only mode (including pdf-view):

(evil-collection-inhibit-insert-state 'pdf-view-mode-map)

This is great except that I believe it overrides a nice keybinding "i" defined in org-noter for inserting a page annotation. Redefining the key binding in org-noter-doc-mode-map and pdf-view-map doesn't help. When I disable evil-collection, I no longer have the problem, but I lose the intuitive evil navigation! Can anyone suggest a workaround besides defining a mapping to a new key (which does work for now)?

I'm using doom on top of Emacs 27.1.

@condy0919
Copy link
Collaborator

evil-collection-pdf-setup is executed after the pdf module loads, so the i
will be redefined with ignore. An :after advice is a solution.

(defun define-my-keybindgs ()
  ;; ...
  )

(advice-add #'evil-collection-pdf-setup :after #'define-my-keybindgs)

@bwetherfield
Copy link
Author

Thanks for your suggestion. I tried the following to no avail:

(defun override-evil-collection-bindings ()
  (define-key org-noter-doc-mode-map (kbd "i") #'org-noter-insert-note)
  )

(advice-add #'evil-collection-pdf-setup :after #'override-evil-collection-bindings)

Have I missed something? Thanks for your help, @condy0919

@condy0919
Copy link
Collaborator

I think you miss a define-key for pdf-view-mode-map

@bwetherfield
Copy link
Author

Still no luck unfortunately!

@jojojames
Copy link
Collaborator

https://github.com/weirdNox/org-noter/blob/9ead81d42dd4dd5074782d239b2efddf9b8b7b3d/org-noter.el#L2048

I think you'll want a new evil-collection mode supporting org-noter as the cleanest solution.

If you just want to hack it up, probably using evil-collection-define-key (or any of the evil-define-* variants) instead of define-key will probably work.

@bwetherfield
Copy link
Author

Hi @jojojames - thanks for looking at this. I am finding that getting a development copy of evil-collection working with my doom emacs config is a bit over my pay grade so I will probably be going for the approach of using different bindings for the timebeing.

@jojojames
Copy link
Collaborator

Sounds good.

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

No branches or pull requests

3 participants