From: "João Távora" <joaotavora@gmail.com>
To: Felician Nemeth <felician.nemeth@gmail.com>
Cc: Yuan Fu <casouri@gmail.com>, 42532@debbugs.gnu.org
Subject: bug#42532: 28.0.50; Can eldoc-prefer-doc-buffer be more aggressive?
Date: Mon, 07 Sep 2020 11:11:39 +0100 [thread overview]
Message-ID: <87zh61x5es.fsf@gmail.com> (raw)
In-Reply-To: <CALDnm51UYaypggCRNWNPd8VAG9Fm4Xvb-mLmW-MMbPtFn=XkVg@mail.gmail.com> ("João Távora"'s message of "Mon, 7 Sep 2020 09:38:16 +0100")
João Távora <joaotavora@gmail.com> writes:
> Regardless, I think it's reasonable to add a third possible value
> for eldoc-prefer-doc-buffer (which should really be renamed
> eldoc-echo-area-prefer-doc-buffer). The value could be the symbol
> 'aggressive or 'aggressively. Then it would behave as you propose:
> if the ElDoc doc buffer is showing, the echo area display code is
> a noop.
>
> What do you think?
Instead of an abstract idea, here's an actual patch you can try on top
of the current eldoc.el
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 772c907c28..2eae30f004 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -111,13 +111,19 @@ eldoc-echo-area-use-multiline-p
symbol names if it will\ enable argument list to fit on one
line" truncate-sym-name-if-fit)))
-(defcustom eldoc-prefer-doc-buffer nil
+(define-obsolete-variable-alias 'eldoc-prefer-doc-buffer
+ 'eldoc-echo-area-prefer-doc-buffer "eldoc-1.11.0")
+(defcustom eldoc-echo-area-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 if ElDoc's
+to be truncated to fit in the echo area, do so if ElDoc's only
documentation buffer is not already showing, since the buffer
-always holds the full documentation."
- :type 'boolean)
+always holds the full documentation. If the value is
+`aggressively' do so even if the documentation doesn't need to be
+truncated."
+ :type '(radio (const :tag "Yes" t)
+ (const :tag "Yes, aggressively." 'aggressively)
+ (const :tag "No" nil)))
(defface eldoc-highlight-function-argument
'((t (:inherit bold)))
@@ -458,7 +464,8 @@ eldoc--handle-docs
(t 1)))
(things-reported-on)
(request eldoc--last-request-state)
- single-doc single-doc-sym)
+ single-doc single-doc-sym
+ (eldoc-buffer-showing (get-buffer-window eldoc--doc-buffer)))
;; Then, compose the contents of the `*eldoc*' buffer.
(with-current-buffer (eldoc-doc-buffer)
;; Set doc-buffer's `eldoc--last-request-state', too
@@ -490,6 +497,9 @@ eldoc--handle-docs
;; function into some `eldoc-display-functions' special hook.
(let ((echo-area-message
(cond
+ ((and eldoc-buffer-showing
+ (eq eldoc-echo-area-prefer-doc-buffer 'aggressively))
+ nil)
(;; We handle the `truncate-sym-name-if-fit' special
;; case first, by checking if for a lot of special
;; conditions.
@@ -519,8 +529,8 @@ eldoc--handle-docs
(while (and (not (bobp)) (bolp)) (goto-char (line-end-position 0)))
finally
(unless (and truncated
- eldoc-prefer-doc-buffer
- (get-buffer-window eldoc--doc-buffer))
+ (eq eldoc-echo-area-prefer-doc-buffer t)
+ eldoc-buffer-showing)
(cl-return
(concat
(buffer-substring (point-min) (point))
next prev parent reply other threads:[~2020-09-07 10:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-25 18:17 bug#42532: 28.0.50; Can eldoc-prefer-doc-buffer be more aggressive? Felician Nemeth
2020-09-07 8:38 ` João Távora
2020-09-07 10:11 ` João Távora [this message]
2020-09-26 12:58 ` Felician Nemeth
2020-10-03 19:18 ` João Távora
2021-01-15 18:00 ` Felician Nemeth
2021-01-15 18:01 ` João Távora
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh61x5es.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=42532@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=felician.nemeth@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).