Skip to content

Embark appears to not automatically load embark-consult upon consult load when installing packages from scratch using use-package #797

@bgoodr

Description

@bgoodr

Referring to this in the readme:

:ensure t) ; only need to install it, embark loads it after consult if found

I discovered that if one has a fresh Emacs installation, and are using use-package to install all three of these packages:

  1. consult
  2. embark
  3. embark-consult

then (featurep 'embark-consult) returns nil.

I do see the code at:

embark/embark.el

Line 4672 in e023888

(with-eval-after-load 'consult

is supposed to handle that, AFAICT:

(with-eval-after-load 'consult
  (unless (require 'embark-consult nil 'noerror)
    (warn "The package embark-consult should be installed if you use both Embark and Consult")))

And that code emit the warning, and in fact, emits it twice in my setup (why twice? I have not figured that out).

But what I have found as a workaround is this:

;; Consult users will also want the embark-consult package.
(use-package embark-consult
  :pin melpa
  :ensure t ;; only need to install it, embark loads it after consult if found (<-- But, that does not happen; see 1710d53f_a94c_48a2_b323_44b40501f4c2 HACK)
  :hook
  (embark-collect-mode . consult-preview-at-point-mode))

;; 1710d53f_a94c_48a2_b323_44b40501f4c2 HACK: There is an almost identical
;; "(with-eval-after-load 'consult...)" construct inside the embark.el file, but
;; it never actually loads the embark-consult package under the conditions where
;; use-package is what is supposed to be loading consult, embark, and
;; embark-consult and under the conditions when those packages are being
;; installed the very first time (or deleting them and then letting use-package
;; install them). So, we have to add it again here to fore the loading to occur:
(with-eval-after-load 'consult
  (unless (require 'embark-consult nil 'noerror)
    (warn "Failed to require the package embark-consult because you are using both Embark and Consult")))

So if there is something messed up elsewhere in my setup that causes this, I would like to know about it so I can correct for it. But I'm reporting this just in case there is an issue in the embark code.

And:

Thank you very much for this package. My productivity is boosted 10x or more from it and the other packages mentioned above!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions