I am unable to determine how eldoc is displaying arguments (or other information) in the mode-line while eval-expression is reading user input in the minibuffer. I could not find a relevant element in the default value of mode-line-format and I also did not find any code where eldoc is prepending an element temporarily to the (local?) value of mode-line-format.

I need this so that I can change the visual appearance, such as its background color.

Note that I did find the complex machinery that determines what information to display; that's not what I am looking for, I only wonder how that information is displayed, whatever it may be.

1 Answer 1


Isn't it:

(defun eldoc-minibuffer-message (format-string &rest args)
  "Display messages in the mode-line when in the minibuffer.
Otherwise work like `message'."


It seems that it prepends eldoc-mode-line-string to mode-line-format and clears it on a minibuffer-exit-hook:

    (add-hook 'minibuffer-exit-hook
          (lambda () (setq eldoc-mode-line-string nil
                  ;; https://debbugs.gnu.org/16920
                  eldoc-last-message nil))
          nil t)
        (setq mode-line-format
          (list "" '(eldoc-mode-line-string
                 (" " eldoc-mode-line-string " "))

It also does a (force-mode-line-update). Not a very polite way to do it, it could just have written to the global-mode-string or added its own lighter...

See how it looks with doom-modeline :(

The heading bar is displaced to the right. Fortunately moody-modeline won't be affected like this, although I don't know how well it plays with ribbons and tabs.

NOTE: all of the above is from emacs-28 branch.

  • Seems pretty obvious now that I look at it again... oO I think I should go to bed.
    – tarsius
    Oct 15, 2021 at 23:07
  • "I don't know how well it plays with ribbons and tabs" yeah, I fear that's gonna require some redefining.
    – tarsius
    Oct 15, 2021 at 23:09

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.