Fix eldoc don't show function signature in some situations

1 min read
Table of Contents
Current issue
The default option eldoc-message-commands
covers the normal use case(already
including self-insert-command
. But it is not add c-electric-*
by default, which
means you will not get function signatures in cc-mode
buffers after you insert
an open bracket. Besides, when using eldoc along with completion frameworks like
corfu
, eldoc will not show up if it is displayed in echo erea.
Solutions
Use eldoc-add-command
and eldoc-add-command-completions
, but don't modify
eldoc-message-commands
directly.
(with-eval-after-load 'eldoc
(eldoc-add-command-completions "c-electric-")
(dolist (command '(corfu-insert corfu-quit))
(eldoc-add-command command)))
There is another option eldoc-print-after-edit
. But after it is set to t, eldoc
will only be shown when editing.
0
Subscribe to my newsletter
Read articles from MKT directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
