elpaca icon indicating copy to clipboard operation
elpaca copied to clipboard

[Bug/Support]: Is this the correct way to load notmuch from system with its version?

Open brabalan opened this issue 1 year ago • 1 comments

Confirmation

  • [X] I have checked the documentation (README, Wiki, docstrings, etc)
  • [ ] I am checking these without reading them.
  • [X] I have searched previous issues to see if my question is a duplicate.

Elpaca Version


Elpaca 43ec2d8 grafted, HEAD -> master, origin/master, origin/HEAD
installer:      0.7
emacs-version:  GNU Emacs 29.1 (build 1, aarch64-apple-darwin23.0.0, Carbon Version 170 AppKit 2487)
 of 2023-11-02
git --version:  git version 2.45.0

Operating System

macos 14.4.1

Description

I struggled to install notmuch from my homebrew installation (to make sure it stays consistent with the tool) and to have it report its version to install ol-notmuch. This is what I ended up doing and I’m wondering if it’s the correct approach (it’s the require notmuch in the version check that bothers me):

(use-package notmuch
  :ensure (:version (lambda (_) (require 'notmuch) notmuch-emacs-version))
  :load-path "/opt/homebrew/share/emacs/site-lisp/notmuch/")

Is it correct?

brabalan avatar May 03 '24 09:05 brabalan

For now the solution is to push the package to elpaca-ignored-dependencies prior to it being queued.

(push 'notmuch elpaca-ignored-dependencies)

However, that's not great for when a dependency is byte-compiled and kind of a hacky solution in general. See: this comment for an explanation of how I'd like to have a way to register packages installed elsewhere with Elpaca.

Does that help?

progfolio avatar May 03 '24 09:05 progfolio

(Sorry for the delay, I was not notified of your reply.)

As what I did works, should I add notmuch to the elpaca-ignored-dependencies? I’m not sure to understand the consequences… Is it to get rid of the version part?

brabalan avatar May 13 '24 12:05 brabalan

(Sorry for the delay, I was not notified of your reply.)

Not a problem

As what I did works, should I add notmuch to the elpaca-ignored-dependencies? I’m not sure to understand the consequences… Is it to get rid of the version part?

Adding it will tell Elpaca "Don't install this if another package requests it as a dependency". What you have now:

(use-package notmuch
  :ensure (:version (lambda (_) (require 'notmuch) notmuch-emacs-version))
  :load-path "/opt/homebrew/share/emacs/site-lisp/notmuch/")

will install the package via Elpaca, but then use-package shadows that version with the version installed by homebrew.

What you'll want for now is:

(use-package notmuch
  :ensure nil
  :init (push 'notmuch elpaca-ignored-dependencies)
  :load-path "/opt/homebrew/share/emacs/site-lisp/notmuch/")

That will tell Elpaca to ignore notmuch as a dependency. The byte-compilation of ol-notmuch will be skipped for now. I have plans to fix that in the future. You'll also want to M-x elpaca-update elpaca and M-x restart-emacs before making that change.

Let me know if that works for you.

progfolio avatar May 13 '24 14:05 progfolio

Ah, I understand. Thank you for the explanation, and I confirm it works great.

brabalan avatar May 14 '24 05:05 brabalan

Ah, I understand. Thank you for the explanation, and I confirm it works great.

Glad to hear it! You're welcome and thank you.

progfolio avatar May 14 '24 09:05 progfolio