diff options
| author | João Távora | 2023-03-24 17:16:00 +0000 |
|---|---|---|
| committer | João Távora | 2023-03-24 17:37:42 +0000 |
| commit | a384401eab59fbc3e551211c4ebf342c73957409 (patch) | |
| tree | fb062fdb0fc6960aad335e51bed3b43be551746c | |
| parent | 3e32865d2c56b9f5048f6f2e5a8236a2bb4e26d8 (diff) | |
| download | emacs-a384401eab59fbc3e551211c4ebf342c73957409.tar.gz emacs-a384401eab59fbc3e551211c4ebf342c73957409.zip | |
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.
| -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: | |||
| 454 | documentation buffer accordingly. | 454 | documentation buffer accordingly. |
| 455 | 455 | ||
| 456 | * `:echo', controlling how `eldoc-display-in-echo-area' should | 456 | * `:echo', controlling how `eldoc-display-in-echo-area' should |
| 457 | present this documentation item, to save space. If VALUE is | 457 | present this documentation item in the echo area, to save |
| 458 | `skip' don't echo DOCSTRING. If a number, only echo DOCSTRING | 458 | space. If VALUE is a string, echo it instead of DOCSTRING. If |
| 459 | up to that character position. | 459 | a number, only echo DOCSTRING up to that character position. |
| 460 | If `skip', don't echo DOCSTRING at all. | ||
| 460 | 461 | ||
| 461 | Finally, major modes should modify this hook locally, for | 462 | Finally, major modes should modify this hook locally, for |
| 462 | example: | 463 | example: |
| @@ -544,7 +545,10 @@ Helper for `eldoc-display-in-echo-area'." | |||
| 544 | for echo = (plist-get plist :echo) | 545 | for echo = (plist-get plist :echo) |
| 545 | for thing = (plist-get plist :thing) | 546 | for thing = (plist-get plist :thing) |
| 546 | unless (eq echo 'skip) do | 547 | unless (eq echo 'skip) do |
| 547 | (when echo (setq this-doc (substring this-doc 0 echo))) | 548 | (setq this-doc |
| 549 | (cond ((integerp echo) (substring this-doc 0 echo)) | ||
| 550 | ((stringp echo) echo) | ||
| 551 | (t this-doc))) | ||
| 548 | (when thing (setq this-doc | 552 | (when thing (setq this-doc |
| 549 | (concat | 553 | (concat |
| 550 | (propertize (format "%s" thing) | 554 | (propertize (format "%s" thing) |