I installed the eglot package to use for C++ development, and it's going fairly well, but one thing that's driving me nuts is the eldoc package. I have a 13 inch MacBook and it's constantly inflating the minibuffer to about 20% of my screen height to tell be about stuff I don't care about. I don't want to uninstall it, because I like the idea of seeing documentation, when I want to. Is there a way to stop it from showing anything as you move the cursor around, and instead use a specific command to trigger the doc display?

  • I'm looking for the same thing. I can't find a way to turn off the eldoc hover support and setting the idle timer to something really large means that the on-demand commands are never populated with information.
    – fommil
    Dec 5, 2023 at 15:02

3 Answers 3


To get this

eldoc-help-at-point (bound to C-h D)




  1. Install eldoc-box: Display ElDoc documentations in a childframe.
  2. Copy the following snippet to my-eldoc-theme.el under custom-theme-directory.
(deftheme my-eldoc "Created 2022-10-08")

(require 'eldoc)
(require 'eldoc-box)

(custom-theme-set-variables 'my-eldoc
                            '(global-eldoc-mode t))

(custom-theme-set-faces 'my-eldoc
                            (:background "yellow")))))

;; (add-hook 'eldoc-mode-hook
;;        'eldoc-box-hover-at-point-mode)

(add-hook 'eldoc-mode-hook

(global-set-key (kbd "C-h D") #'eldoc-box-help-at-point)

(provide-theme 'my-eldoc)

  1. M-x load-theme RET my-eldoc RET

  2. Try hovering over a symbol, what happens

  3. Try C-h D on a symbol, see what happens

  • This answers the "popup" part of the question, but this is still happening on hover... it's not "on demand".
    – fommil
    Dec 5, 2023 at 15:01

I've also wanted this, and was helped by the author of eglot to reach a solution in https://github.com/joaotavora/eglot/discussions/1328

The main trick is to let eglot setup all of its hooks into eldoc, but then turn off the eldoc minor mode which attempts to obtain and show docs on every user command (well, there's a list of commands... but basically every keystroke)

 (lambda ()
   ;; we want eglot to setup callbacks from eldoc, but we don't want eldoc
   ;; running after every command. As a workaround, we disable it after we just
   ;; enabled it. Now calling `M-x eldoc` will put the help we want in the eldoc
   ;; buffer. Alternatively we could tell eglot to stay out of eldoc, and add
   ;; the hooks manually, but that seems fragile to updates in eglot.
   (eldoc-mode -1)))

Now you can call M-x eldoc to get the info at point in a buffer that pops up.

You may want to only have it show the short form in the echo area, which is a little more involved. To do that you need to upgrade to the latest version of eldoc, and modify your eldoc-display-functions. I personally use this little helper

(defun eldoc-fancy (arg)
  "`eldoc' but uses the echo area by default and a prefix will swap to a buffer."
  ;; https://github.com/joaotavora/eglot/discussions/1328
  (interactive "P")
  (let (_)
    (defvar eldoc-display-functions)
    (setq eldoc-display-functions
          (if arg '(eldoc-display-in-buffer) '(eldoc-display-in-echo-area)))
    (eldoc t)))

I agree that the eldoc area moving around is distracting, especially on a small screen. However, I think eldoc is useful, so a compromise is to keep eldoc enabled by request that it should only display a single line of information and therefore never resize the echo area:

(setq eldoc-echo-area-use-multiline-p nil)

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.