Eldoc: slightly enhance meaning of :echo option

Can now be a string to echo instead of a larger docstring.

* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions):
Describe :echo.
(eldoc--echo-area-render): Allow :echo to be string.
This commit is contained in:
João Távora 2023-03-24 17:16:00 +00:00
parent 3e32865d2c
commit a384401eab

View file

@ -454,9 +454,10 @@ documentation-displaying frontends. For example, KEY can be:
documentation buffer accordingly.
* `:echo', controlling how `eldoc-display-in-echo-area' should
present this documentation item, to save space. If VALUE is
`skip' don't echo DOCSTRING. If a number, only echo DOCSTRING
up to that character position.
present this documentation item in the echo area, to save
space. If VALUE is a string, echo it instead of DOCSTRING. If
a number, only echo DOCSTRING up to that character position.
If `skip', don't echo DOCSTRING at all.
Finally, major modes should modify this hook locally, for
example:
@ -544,7 +545,10 @@ Helper for `eldoc-display-in-echo-area'."
for echo = (plist-get plist :echo)
for thing = (plist-get plist :thing)
unless (eq echo 'skip) do
(when echo (setq this-doc (substring this-doc 0 echo)))
(setq this-doc
(cond ((integerp echo) (substring this-doc 0 echo))
((stringp echo) echo)
(t this-doc)))
(when thing (setq this-doc
(concat
(propertize (format "%s" thing)