emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a384401eab5 1/2: Eldoc: slightly enhance meaning of :echo option


From: João Távora
Subject: master a384401eab5 1/2: Eldoc: slightly enhance meaning of :echo option
Date: Fri, 24 Mar 2023 13:36:00 -0400 (EDT)

branch: master
commit a384401eab59fbc3e551211c4ebf342c73957409
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]