diff options
author | João Távora <joaotavora@gmail.com> | 2023-03-24 17:16:00 +0000 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2023-03-24 17:37:42 +0000 |
commit | a384401eab59fbc3e551211c4ebf342c73957409 (patch) | |
tree | fb062fdb0fc6960aad335e51bed3b43be551746c /lisp/emacs-lisp | |
parent | 3e32865d2c56b9f5048f6f2e5a8236a2bb4e26d8 (diff) | |
download | emacs-a384401eab59fbc3e551211c4ebf342c73957409.tar.gz |
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/eldoc.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 05033f39cba..ccc466cfd44 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -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) |