-
Notifications
You must be signed in to change notification settings - Fork 272
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
once / deferred loading / new binding package #644
Comments
I added tests for once today. I'll try it out with those evil-collection packages when I get a chance.
Maybe Though switching from
That would definitely simplify things if the underlying implementation changed.
We do need to check the old definition prior to binding, but that could potentially be done outside annalist. Annalist does have some extra overhead when storing. I need to rethink some things about annalist, and I'll have to test to see if it makes a significant difference in startup time. It may or may not be worth it. |
Anything I can do to get help, testing etc? |
Sorry for the delay. I'm still quite busy, but I'm going to try get back to cleaning up once.el and putting it on MELPA soon since it is fairly close to done. If I remember correctly, the issue was to more intelligently defer packages rather than using an idle timer.
Here are the features I listed before that loaded for me with emacs -Q:
Calc mode could probably be handled by using (once (list :hooks 'calc-mode-hook)
(require 'evil-collection-calc)
(evil-collection-calc-setup)) If that works, I think I found For eldoc, advising before (once (list :before #'eldoc-doc-buffer)
(require 'evil-collection-eldoc)
(evil-collection-eldoc-setup)) Handling simple would probably be more complex. You'd need to wait until the user actually visits a buffer in simple mode. Doom, for example, implements its buffer switch hook using (once (list :hooks 'window-buffer-change-functions 'server-visit-hook
:check (lambda () (eq major-mode 'special-mode)))
(require 'evil-collection-simple)
(evil-collection-simple-setup)) Overall, I think |
I think other than the emacs -Q packages, we'd still need to have a story for packages users may download and load other than their default emacs -Q packages as that can cause slowdown too.
We already use eval-after-load/with-eval-after-load I believe. I think avoiding even adding the the function to with-eval-after-load is ideal.
Hooks seems more ideal than with-eval-after-load but I figure we'd want it to be configurable (hopefully that's where once comes in).
I'm envisioning some configuration variable users can customize to their mode list (and we supply a default one) that can set up how much evil-collection file is loaded. Not sure what it could look like, maybe:
(random pseudocode) |
Follow up to: d97e6d5
Creating an issue to better track the discussion, @noctuid
An interface I was thinking of was to have the definer (general/bind-key/define-key/whatever) actually take in the white/black list and respect it. So you could do something like
(setf general-white-list '("a" "b" "etc")) (general-bind "a" 'some-function "b" 'some-other-function)
That way the white/black list is handled at an even lower level than evil-collection. Trying to think of scenarios where that would not be preferable and can't think of any off the top of my head. As for how to interface with it, either defalias the current whitelists to the implementation variable or just do something like:
(setf general-white-list evil-collection-white-list) (just using the general prefix, but in general i'd prefer something shorter)
Yeah, it might make sense to defer annalist but I thought we needed to do the recording at the time the define-key is called?
I try to just use what's already there. I find the aliases, etc (or even writing hand made utility functions to save some duplication) not super worth it sometimes.
That's a super interesting idea. I may actually create a new package called vimdef (dunno, will pick something...) and refactor all the evil-collection stuff to use that new package. Users could reuse the same package in their own configuration and that would be able to leverage all the evil-collection stuff. I'll have to think further on that, just an idea for now..
The text was updated successfully, but these errors were encountered: