Skip to content

Include minor modes#28

Open
jbaum98 wants to merge 1 commit intocofi:masterfrom
jbaum98:master
Open

Include minor modes#28
jbaum98 wants to merge 1 commit intocofi:masterfrom
jbaum98:master

Conversation

@jbaum98
Copy link

@jbaum98 jbaum98 commented Nov 11, 2015

This allows you to use evil-leader/set-key-for-mode to set minor-mode specific maps. I think this also addresses #27.

evil-leader.el Outdated
(minor-modes (mapcar 'car minor-mode-alist))
(active-modes (cons major-mode minor-modes))
(get-keymap-for-mode (lambda (mode) (cdr (assoc mode evil-leader--mode-maps))))
(mode-map (apply 'append (mapcar 'get-keymap-for-mode active-modes)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be unquoted get-keymap-for-mode here. Lambdas are self-quoting and the quoted version does not work on my Emacs (25 prerelease)

@lionel-
Copy link

lionel- commented Feb 18, 2016

Thanks for writing this, much needed!

@cofi, any chance of including this? I am starting using it right now and will report back issues if any.

@lionel-
Copy link

lionel- commented Feb 18, 2016

One problem is that there's no guarantee evil-leader is the last loaded minor mode. So minor-mode-alist (which looks a bit hacky to use anyway) does not contain all relevant minor modes unless you reload the buffer.

I think a cleaner way to do this would involve adding local leader keys in minor modes' hooks.

(evil-leader/set-local-key) would probably have to account for the possibility of evil-leader not being active yet when the hook is run. So, if not yet loaded: add local variable containing local bindings. If already loaded: add local variable then relaunch evil-leader

@jbaum98
Copy link
Author

jbaum98 commented Feb 21, 2016

@lionel- I unquoted get-keymap-for-mode. I'm not quite sure how to implement this feature the way you suggested with minor mode hooks. I'm a relatively inexperienced emacs hacker, so could you explain more precisely how I would do it that way? Or if you want to implement it yourself, please feel totally free to do that. Thanks for your help!

@lionel-
Copy link

lionel- commented Feb 21, 2016

See #35 ;)

@jbaum98
Copy link
Author

jbaum98 commented Feb 21, 2016

Oh nice! Didn't see that.

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