From a384401eab59fbc3e551211c4ebf342c73957409 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 24 Mar 2023 17:16:00 +0000 Subject: [PATCH] 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. --- lisp/emacs-lisp/eldoc.el | 12 ++++++++---- 1 file 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) -- 2.39.2