[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/eldoc-async 0612bb7 4/6: Introduce eldoc-prefer-doc-buffer defcu
From: |
João Távora |
Subject: |
scratch/eldoc-async 0612bb7 4/6: Introduce eldoc-prefer-doc-buffer defcustom |
Date: |
Wed, 3 Jun 2020 13:54:06 -0400 (EDT) |
branch: scratch/eldoc-async
commit 0612bb7ab504619765ac60b947cad106d0a940f2
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Introduce eldoc-prefer-doc-buffer defcustom
* lisp/emacs-lisp/eldoc.el (eldoc-prefer-doc-buffer): New defcustom.
(eldoc--handle-docs): Use it.
---
lisp/emacs-lisp/eldoc.el | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index f0a9a5b..f7a1c56 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -113,6 +113,13 @@ documentation string visible."
symbol names if it will\ enable argument list to fit on one
line" truncate-sym-name-if-fit)))
+(defcustom eldoc-prefer-doc-buffer nil
+ "Prefer Eldoc's documentation buffer if it is showing in some frame.
+If this variable's value is t and a piece of documentation needs
+to be truncated to fit in the echo area, do so only if Eldoc's
+documentation buffer is not already showing."
+ :type 'boolean)
+
(defface eldoc-highlight-function-argument
'((t (:inherit bold)))
"Face used for the argument at point in a function's argument list.
@@ -420,14 +427,17 @@ Honour most of `eldoc-echo-area-use-multiline-p'."
do (goto-char (line-end-position (if truncated 0 -1)))
(while (bolp) (goto-char (line-end-position 0)))
finally
- (eldoc-message
- (concat (buffer-substring (point-min) (point))
- (and truncated
- (format
- "\n(Documentation truncated. Use `%s' to see rest)"
- (substitute-command-keys
"\\[eldoc-doc-buffer]")))))))
+ (unless (and truncated
+ eldoc-prefer-doc-buffer
+ (get-buffer-window eldoc--doc-buffer))
+ (eldoc-message
+ (concat (buffer-substring (point-min) (point))
+ (and truncated
+ (format
+ "\n(Documentation truncated. Use `%s' to see rest)"
+ (substitute-command-keys
"\\[eldoc-doc-buffer]"))))))))
((= available 1)
- ;; truncate brutally
+ ;; truncate brutally ; FIXME: use `eldoc-prefer-doc-buffer' here,
too?
(eldoc-message
(truncate-string-to-width
(replace-regexp-in-string "\n" " " (car (car docs))) width))))))))
- branch scratch/eldoc-async created (now 10834f2), João Távora, 2020/06/03
- scratch/eldoc-async cde8a6a 1/6: Better handle asynchronously produced eldoc docstrings, João Távora, 2020/06/03
- scratch/eldoc-async 0612bb7 4/6: Introduce eldoc-prefer-doc-buffer defcustom,
João Távora <=
- scratch/eldoc-async fe93e5b 5/6: Make eldoc-print-current-symbol-info a command, João Távora, 2020/06/03
- scratch/eldoc-async 10834f2 6/6: * lisp/emacs-lisp/eldoc.el (Version): Bump to 1.1.0, João Távora, 2020/06/03
- scratch/eldoc-async 600b9c0 2/6: New eldoc-documentation-eager value for eldoc-documentation-function, João Távora, 2020/06/03
- scratch/eldoc-async 40d4506 3/6: Overhaul and handle (most of) eldoc-echo-area-use-multiline-p in Eldoc itself, João Távora, 2020/06/03