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

Guidance on loading package extensions like vertico-directory #10

Closed
ashton314 opened this issue Aug 18, 2022 · 5 comments
Closed

Guidance on loading package extensions like vertico-directory #10

ashton314 opened this issue Aug 18, 2022 · 5 comments

Comments

@ashton314
Copy link
Contributor

Hi there!

First off: this is amazing. The load time on my Emacs is just insane now. Thank you so much!

I use vertico, which has a number of extensions that come bundled with the package. I would like to get vertico-directory working.

If I were using straight.el, I would just put this:

(elpaca-use-package vertico
  :defer t
  :straight (vertico :files (:defaults "extensions/*")
                     :includes vertico-directory)
  :bind (:map vertico-map
              ("M-DEL" . vertico-directory-delete-word))
  :hook (rfn-eshadow-update-overlay . vertico-directory-tidy)
  :init
  (vertico-mode))

Or even this after (use-package vertico :init (vertico-mode)): (taken from vertico's README)

(use-package vertico-directory
  :after vertico
  :bind (:map vertico-map
              ("M-DEL" . vertico-directory-delete-word))
  :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))

How would I do this with elpaca? (elpaca-use-package vertico-directory) can't find any repository. I'm honestly not sure what magic use-package and straight are doing to get it to work in the previous examples, but work it does.

@progfolio
Copy link
Owner

progfolio commented Aug 18, 2022

First off: this is amazing. The load time on my Emacs is just insane now. Thank you so much!

Thank you for helping me test Elpaca out.
Glad you're finding it useful.
I'd be interested to see some before/after load and install times if you're able to get them.

The asynchronous nature of Elpaca takes some getting used to and I definitely need to improve the idioms available for common cases like the one described here.

Try the following and let me know if it works:

This should install vertico and configure it once Elpaca's queue has processed.

;;bootstrapping snippet omitted 
;;installation of use-package omitted
(elpaca-use-package (vertico :files (:defaults "extensions/*"))
  :defer t
  :bind (:map vertico-map
              ("M-DEL" . vertico-directory-delete-word))
  :hook (rfn-eshadow-update-overlay . vertico-directory-tidy)
  :init (vertico-mode))

And this should execute the use-package call in the same queue, just after configuring vertico.

(elpaca nil
  (use-package vertico-directory
    :after vertico
    :bind (:map vertico-map
                ("M-DEL" . vertico-directory-delete-word))
    :hook (rfn-eshadow-update-overlay . vertico-directory-tidy)))

I'm honestly not sure what magic use-package and straight are doing to get it to work

straight implements a use-package keyword which affects the expansion of the use-package macro. It basically expands to:

(progn
  (straight-use-package name)
  ;;rest of use-package declaration expansion
)

The added challenge with Elpaca is getting that to play nice asynchronously.
I'm working on a solution for that now.

@ashton314
Copy link
Contributor Author

That worked like a charm after rebuilding vertico. Thanks!

I'd be interested to see some before/after load and install times if you're able to get them.

I'll try doing something a little more rigorous later, but if I remember right, I was seeing ~0.5–1.2s on average with straight.el; now I'm getting ~0.2–0.25s with elpaca

@bram85
Copy link

bram85 commented Dec 7, 2022

Try the following and let me know if it works:

This should install vertico and configure it once Elpaca's queue has processed.

;;bootstrapping snippet omitted 
;;installation of use-package omitted
(elpaca-use-package (vertico :files (:defaults "extensions/*"))
  :defer t
  :bind (:map vertico-map
              ("M-DEL" . vertico-directory-delete-word))
  :hook (rfn-eshadow-update-overlay . vertico-directory-tidy)
  :init (vertico-mode))

And this should execute the use-package call in the same queue, just after configuring vertico.

(elpaca nil
  (use-package vertico-directory
    :after vertico
    :bind (:map vertico-map
                ("M-DEL" . vertico-directory-delete-word))
    :hook (rfn-eshadow-update-overlay . vertico-directory-tidy)))

Unfortunately I can't get it to work:

(elpaca-use-package (vertico :files (:defaults "extensions/*"))
  :init
  (vertico-mode))

(elpaca nil
        (use-package vertico-flat
              :after vertico))

use-package generates a warning that vertico-flat couldn't be loaded. However, when enabling use-package's verbose mode, it says

Loading package vertico...done
Loading package vertico-flat...done

Is it stil the correct way to load vertico's extensions?

@progfolio
Copy link
Owner

@bram85: please open a new support issue here:

https://github.com/progfolio/elpaca/issues/new?assignees=&labels=support&template=support.yml&title=%5BSupport%5D%3A+

Include the use-package warning and any output from M-x elpaca-log in the relevant info section.

@bram85
Copy link

bram85 commented Dec 7, 2022

Resolved, I forgot to call elpaca-rebuild on the vertico package. I was still a bit more in straight.el mode where recipe changes are picked up automatically on the next restart.

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