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

Enable evil-collection per mode, without global evil-want-integration disabled #115

Closed
naclander opened this issue Apr 1, 2018 · 8 comments

Comments

@naclander
Copy link

naclander commented Apr 1, 2018

First off, thanks so much for the great collection of keybindings.

I was interested in using the evil keybindings in this package for elfeed, but after reading the documentation I noticed I had to set evil-want-integration to nil. This conflicets with a bunch of existing configuration I already have set up.

It seems like to only enable collections ( elfeed, in my case ), users shouldn't have to disable or enable anything. After all we're just setting some pre-defined evil-mode-map keybindings.

It would be great if I could enable some collections without disabling evil-want-integration.

What I ended up doing was copying the evil keybindings directly and adding the to my init.el, which got the job done without changing anything else, but is obviously not ideal =\ .

@jojojames
Copy link
Collaborator

I'm not sure how I feel about supporting the use case where you're using evil-collection but still enabling evil-want-integration/evil-integration.

What about evil-collection-integration doesn't work with your config? It should be close to a 1:1 mapping with the original evil-integration file except for some naming changes.

@naclander
Copy link
Author

Specifically in my case, when I turned evil-want-integration to nil, various org-mode key-bindings I had manually set up got overridden.

So from my perspective, just to enable evil-collection for an unrelated package ( elfeed ) I had actually changed keybindings in org-mode as well ( and potentially other modes, I did not investigate further ).

This seems really unnecessary and not very user-friendly, since all I really want is some evil keybindings specifically when using elfeed-mode. It seems to be that when I enable evil-collection for elfeed only elfeed keybidnings should change, not org ones. However by forcing evil-want-integration to be set or unset you're potentially forcing users to change unrelated keybindings.

To me it seems like evil-collection shouldn't rely at all on evil-want-integration. Can you explain why it has to be set to nil? What is wrong with keeping it at whatever previous value a user wants? What can't the package-load order ( as determined usually by users in their config ) determine which bindings supersede others?

@jojojames
Copy link
Collaborator

Can you explain why it has to be set to nil? What is wrong with keeping it at whatever previous value a user wants? What can't the package-load order ( as determined usually by users in their config ) determine which bindings supersede others?

See

#60 and
emacs-evil/evil#992

I think if you just want elfeed, you can explicitly require that mode and call its setup function. There may or may not be some trickiness depending on how you install evil-collection.

when I turned evil-want-integration to nil, various org-mode key-bindings I had manually set up got overridden.

As for that, we may want to dig deeper here. As mentioned before, evil-collection-integration should be fairly faithful to the original evil-integration, save some name changes.

@jojojames
Copy link
Collaborator

Closing for now but #60 may or may not be related/help.

@naclander
Copy link
Author

@jojojames

I think if you just want elfeed, you can explicitly require that mode and call its setup function

Can you provide an example of how to do this ( assuming evil-collection is installed in the normal location ) because if this is doable with a few lines this would solve my problem.

Like I've said, I've had to copy elisp code directly out of evil-collection because there was no way of enabling it without also disabling evil-want-integration.

This is bad because evil-want-integration is seemingly completely unrelated and changes various other things in evil which are completely orthogonal and unrelated to the keybindings I'm trying to enable ( in this case elfeed ).

I really don't understand why you're requiring users to enable/disable unrelated features when in reality all we're doing is enabling some mode specific evil friendly keybindings. No other keybindings should change except for those in that mode, or else the user experience is really poor.

Thanks for the help so far, but I don't think #60 is related to this problem. I think by fixing the original cause of this issue we'll be making evil-collection a lot more useful to people.

@noctuid
Copy link
Contributor

noctuid commented Apr 24, 2018

Can you provide an example of how to do this

(evil-collection-init 'elfeed). See the readme for other ways to do it.

Like I've said, I've had to copy elisp code directly out of evil-collection because there was no way of enabling it without also disabling evil-want-integration.

evil-collection doesn't fail if you don't set evil-want-integration to nil. It's not forcing you to change the value; it just doesn't guarantee that there won't be any issues (though there shouldn't if you are just using this package for elfeed).

Specifically in my case, when I turned evil-want-integration to nil, various org-mode key-bindings I had manually set up got overridden.

Are you sure that was the issue? evil-integration.el does nothing related to org mode.

This is bad because evil-want-integration is seemingly completely unrelated

It is completely related. evil-collection is a replacement for everything in evil-integration. evil-collection does more than provide keybindings, and evil-integration absolutely does alter/make keybindings (that's the main reason evil-want-integration was added).

Thanks for the help so far, but I don't think #60 is related to this problem.

With the suggestions there implemented, you could enable "integration" for all modes and keybindings only for the ones you want to. This would mean that there wouldn't be a reason to keep evil-want-integration non-nil.

@jojojames
Copy link
Collaborator

I agree with @noctuid.

If you still want to, you can suppress the warning. (I do not recommend this but it should work.)

(use-package evil-collection
  :ensure t
  :after evil
  :init
  (setq warning-suppress-types '((evil-collection)))
  :config
  (evil-collection-init 'elfeed))

@jojojames
Copy link
Collaborator

Heads up if you did supress the warning, you'll want to set evil-want-keybinding to nil and evil-want-integration to t which will use evil's evil-integration.el.

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