Emacs ElDoc: Display Function or Variable Information Near Point (Cursor)

Last updated on December 10, 2016

ElDoc mode is a minor mode that displays information about a function or variable in the text at point (cursor). However, by default, it displays the information in the echo area, which isn't quite ideal since our eyes often need to traverse half of the screen to view that information:

ElDoc message in the echo area

To make the information display near the point (cursor), install pos-tip.el, and add the following to your Emacs init file:

(defun my-eldoc-display-message (format-string &rest args)
  "Display eldoc message near point."
  (when format-string
    (pos-tip-show (apply 'format format-string args))))
(setq eldoc-message-function #'my-eldoc-display-message)

A screenshot:

ElDoc pos-tip

4 thoughts on “Emacs ElDoc: Display Function or Variable Information Near Point (Cursor)

  1. Pingback: 2016-11-07 Emacs News - sacha chua :: living an awesome life

Leave a Reply

Your email address will not be published. Required fields are marked *