Linux Mint 20.3

Emacs 27

For every command I get the next message in minibuffer:

eldoc error: (void-function embark-eldoc-first-target) 

He my setting of embark package in init.el

(use-package embark
  :ensure t
   ("M-." . embark-dwim)      ;; good alternative: M-.
   ("C-S-a" . embark-act)
   ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
  ;; Optionally replace the key help with a completing-read interface
  (setq prefix-help-command #'embark-prefix-help-command)
  ;; Show the Embark target at point via Eldoc.  You may adjust the Eldoc
  ;; strategy, if you want to see the documentation from multiple providers.
  (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
  ;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
  ;; C-x C-h
  (setq prefix-help-command #'embark-prefix-help-command) ;; you can filter
  ;; Hide the mode line of the Embark live/completions buffers
  (add-to-list 'display-buffer-alist
               '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
                 (window-parameters (mode-line-format . none)))))

;; Consult users will also want the embark-consult package.
(use-package embark-consult
  :ensure t ; only need to install it, embark loads it after consult if found
  (embark-collect-mode . consult-preview-at-point-mode))

enter image description here


2 Answers 2


Please tell me if there is anything wrong with that. But you can definitely avoid the error by placing (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)

behind the config: keyword instead of the init: keyword.


The issue is that eldoc will call embark-eldoc-first-target before embark is loaded (since the :bind part of your use-package form will defer loading until one of the keys you set is pressed).

Solution: explicitly load embark by putting

:demand t

near the top of the use-package form.

  • Why the downvote? I don't know if this is correct or not, but it looks plausible at first sight.
    – NickD
    Mar 21, 2023 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.