From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#42532: 28.0.50; Can eldoc-prefer-doc-buffer be more aggressive? Date: Mon, 07 Sep 2020 11:11:39 +0100 Message-ID: <87zh61x5es.fsf@gmail.com> References: <87mu3nihmp.fsf@betli.tmit.bme.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36671"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Yuan Fu , 42532@debbugs.gnu.org To: Felician Nemeth Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 07 12:12:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFE8A-0009P3-Ii for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 07 Sep 2020 12:12:10 +0200 Original-Received: from localhost ([::1]:46262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFE89-0005lS-Fw for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 07 Sep 2020 06:12:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFE82-0005jZ-Ja for bug-gnu-emacs@gnu.org; Mon, 07 Sep 2020 06:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFE82-0000s5-AR for bug-gnu-emacs@gnu.org; Mon, 07 Sep 2020 06:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kFE82-0007TM-4p for bug-gnu-emacs@gnu.org; Mon, 07 Sep 2020 06:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Sep 2020 10:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42532 X-GNU-PR-Package: emacs Original-Received: via spool by 42532-submit@debbugs.gnu.org id=B42532.159947350928704 (code B ref 42532); Mon, 07 Sep 2020 10:12:02 +0000 Original-Received: (at 42532) by debbugs.gnu.org; 7 Sep 2020 10:11:49 +0000 Original-Received: from localhost ([127.0.0.1]:48122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFE7p-0007St-5E for submit@debbugs.gnu.org; Mon, 07 Sep 2020 06:11:49 -0400 Original-Received: from mail-wr1-f49.google.com ([209.85.221.49]:32867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFE7n-0007Sd-PD for 42532@debbugs.gnu.org; Mon, 07 Sep 2020 06:11:48 -0400 Original-Received: by mail-wr1-f49.google.com with SMTP id m6so15220657wrn.0 for <42532@debbugs.gnu.org>; Mon, 07 Sep 2020 03:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=RUcaU+4zK8T0aUCYSf8FFOMw3dq64E7h2O7gFXfRNYw=; b=MLzynXqb63MBDNf7Tfmp6VNeyjkf4EDnilKTNxmE9rGK97vQsjHkRyUC+F+Rkwey6r 2V1rkcuJzXE7pssqZ4Kd1iYCCXBA7zzNZTk7Qmk87oomY4BFOT2qE065/2o6JPqvC0/Y l13i165Jtp2GgfIjyx6+bqnZNGDXUAM6Gmk28p4z/z+mgzLC4MpBTKDH9Fqf/pKGjtjZ 6/5qz8+3cZ90FMH/0qWlujrG3bSadCaINJtABFeCSO2IPd+JuPdneT0ed/Z7m/JoLoCO D3Bq4+N1PCFoEk2+0zRvwo3jR/M9XDDPxgWaEjkj3dyVTqclU5uBForEESFAGTvNEnHk L/xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=RUcaU+4zK8T0aUCYSf8FFOMw3dq64E7h2O7gFXfRNYw=; b=W1R00+B/aKenz+u0KQT3t4z5591nh3WQJqac01onrSBN5rrLQSkMTX29e57DCghOOe +H+FCKmGsJFmv28eH8eKb+fqUM73N2G60D7Vk/1kCsEEA2mFKvohZRhcW1Q0rci31eOU 1N9/fQVtPb0JMPpGie6W1gstxxT04/sYxktwXymMDNdHqIM/Dd/5HIOo2WIqfVrNBcp0 DLezSYAaLN1tCoJEq/CTXAGpSsQ/ig/AqfIdgHWzrwCSk/iyVHv4DZ7Wt9lURvC1UsZh BYSeVZOsNvcfRBQJjdlSE8yVOtDcUEpIlb3MtWfqoOXflUDdH15zOJDRbHZikLWWFoBW KqZw== X-Gm-Message-State: AOAM5305wR7dLTI6NqzOoMec7CzszwsT6MWqAsXcQBw3dApZc2B1Wqo9 3bXNkHza0TB2eltinjJR/OksZhnG4tU= X-Google-Smtp-Source: ABdhPJz6AHJ+WOuksAw4HJN+3Lld4FTRosMAq/IOGAehaXvlW+kdgoY4m3SBibfsz9X0wVQiWZ5AEA== X-Received: by 2002:adf:efc9:: with SMTP id i9mr21655301wrp.187.1599473501516; Mon, 07 Sep 2020 03:11:41 -0700 (PDT) Original-Received: from krug ([89.180.148.45]) by smtp.gmail.com with ESMTPSA id l9sm26699621wmh.1.2020.09.07.03.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 03:11:40 -0700 (PDT) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Mon, 7 Sep 2020 09:38:16 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187419 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > Regardless, I think it's reasonable to add a third possible value=20 > for eldoc-prefer-doc-buffer (which should really be renamed=20 > 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=20 > 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))) =20 -(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))) =20 (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-po= sition 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))