all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 62029@debbugs.gnu.org, Yuan Fu <casouri@gmail.com>
Subject: bug#62029: 29.0.60; Allow users to customize eldoc buffer separator
Date: Thu, 13 Apr 2023 11:48:35 +0100	[thread overview]
Message-ID: <CALDnm539_QTPiM1Q6XJZauM_o9p_Gw2XQUpn25+5Heq7uxbwzQ@mail.gmail.com> (raw)
In-Reply-To: <CALDnm51taS+45kiqYdjJjsG2Y-dL7=hFrOGfiSMnWQVmipgO9Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

On Thu, Apr 13, 2023 at 11:11 AM João Távora <joaotavora@gmail.com> wrote:
>
> On Thu, Apr 13, 2023 at 10:48 AM João Távora <joaotavora@gmail.com> wrote:
>
> > > Is that bug Elisp-specific? That would seem odd.
> >
> > You seem to be describing a separate problem that I never noticed or was
> > bothered with (and I do use company and multi-line echo areas
> > liberally).  I'll try your recipe but would you describe exactly what to
> > look for?
>
> I've reproduced the bug with your recipe.  I don't normally notice
> because I use a TTY emacs for the most part and it's absent there.
> But in a graphical frame it is noticeable.  I'm having a look.
>
> You could create a new bug report or point me to an existing one
> I might have missed.

In the meantime, please try this patch.

João

[-- Attachment #2: 0001-Eldoc-don-t-overdisplay-if-using-eldoc-documentation.patch --]
[-- Type: text/x-patch, Size: 3647 bytes --]

From 5ea3b210a9f86b25e4999d3e55ec6bda4f6469af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= <joaotavora@gmail.com>
Date: Thu, 13 Apr 2023 11:46:12 +0100
Subject: [PATCH] Eldoc: don't overdisplay if using eldoc-documentation-compose

This is about a particular value for eldoc-documentation-strategy.
'eldoc--documentation-compose-1' for the "patient"
'eldoc-documentation-compose' strategy was buggy.  It created and
callback and arranged so that it could potentially be invoked
immediately and trigger display, half-defeating the purpose of the
"patience" and causing blinking in the echo area.

Now it creates all the callbacks beforehand and only then passes them
to the corresponding members of eldoc-documentation-functions.  This
sets up the correct state in eldoc--invoke-strategy.

* lisp/emacs-lisp/eldoc.el (eldoc--documentation-compose-1):
Delete.
(eldoc-documentation-compose)
(eldoc-documentation-compose-eagerly): Rework.
---
 lisp/emacs-lisp/eldoc.el | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 1eb0d38c5ce..55fb518f990 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -681,29 +681,34 @@ eldoc-documentation-default
                     (lambda (f)
                       (funcall f (eldoc--make-callback :eager f)))))
 
-(defun eldoc--documentation-compose-1 (eagerlyp)
-  "Helper function for composing multiple doc strings.
-If EAGERLYP is non-nil show documentation as soon as possible,
-else wait for all doc strings."
-  (run-hook-wrapped 'eldoc-documentation-functions
-                    (lambda (f)
-                      (let* ((callback (eldoc--make-callback
-                                        (if eagerlyp :eager :patient)
-                                        f))
-                             (str (funcall f callback)))
-                        (if (or (null str) (stringp str)) (funcall callback str))
-                        nil)))
-  t)
-
 (defun eldoc-documentation-compose ()
   "Show multiple documentation strings together after waiting for all of them.
 This is meant to be used as a value for `eldoc-documentation-strategy'."
-  (eldoc--documentation-compose-1 nil))
+  (let (fns-and-callbacks)
+    ;; Make all the callbacks, this sets up state inside
+    ;; `eldoc--invoke-strategy' to know how many to wait for before
+    ;; displaying (bug#xxxxx)
+    (run-hook-wrapped 'eldoc-documentation-functions
+                      (lambda (f)
+                        (push (cons f (eldoc--make-callback :patient f))
+                              fns-and-callbacks)
+                        nil))
+    ;; Now call them.  The last one will trigger the display.
+    (cl-loop for (f . callback) in fns-and-callbacks
+             for str = (funcall f callback)
+             when (or (null str) (stringp str)) do (funcall callback str)))
+  t)
 
 (defun eldoc-documentation-compose-eagerly ()
   "Show multiple documentation strings one by one as soon as possible.
 This is meant to be used as a value for `eldoc-documentation-strategy'."
-  (eldoc--documentation-compose-1 t))
+  (run-hook-wrapped 'eldoc-documentation-functions
+                    (lambda (f)
+                      (let* ((callback (eldoc--make-callback :eager f))
+                             (str (funcall f callback)))
+                        (if (or (null str) (stringp str)) (funcall callback str))
+                        nil)))
+  t)
 
 (defun eldoc-documentation-enthusiast ()
   "Show most important documentation string produced so far.
-- 
2.39.2


  reply	other threads:[~2023-04-13 10:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  7:56 bug#62029: 29.0.60; Allow users to customize eldoc buffer separator Yuan Fu
2023-03-08  0:25 ` bug#62030: " Yuan Fu
2023-03-08 17:14 ` bug#62029: " João Távora
2023-03-08 21:28   ` Yuan Fu
2023-03-23 21:33     ` João Távora
2023-03-24  0:12       ` Yuan Fu
2023-03-24 17:44         ` João Távora
2023-03-25  3:04           ` Yuan Fu
2023-03-25  8:10             ` João Távora
2023-03-30  5:22               ` Yuan Fu
2023-03-30  8:13                 ` João Távora
2023-03-30  8:25                   ` Yuan Fu
2023-04-11  0:04                   ` Dmitry Gutov
2023-04-11 11:25                     ` João Távora
2023-04-12  1:38                       ` Dmitry Gutov
2023-04-12 11:06                         ` João Távora
2023-04-13  0:20                           ` Dmitry Gutov
2023-04-13  4:20                             ` Yuan Fu
2023-04-13  9:50                             ` João Távora
2023-04-13 10:11                               ` João Távora
2023-04-13 10:48                                 ` João Távora [this message]
2023-04-13 21:53                               ` Dmitry Gutov
2023-04-13 22:13                                 ` Dmitry Gutov
2023-04-13 23:01                                 ` João Távora
2023-04-13 23:26                                   ` Dmitry Gutov
2023-04-14  0:04                                     ` João Távora
2023-04-14 23:50                                       ` Dmitry Gutov
2023-04-15  9:41                                         ` João Távora
2023-10-23  1:39                                           ` Dmitry Gutov
2023-04-18  0:47                                       ` Dmitry Gutov
2023-04-18 11:17                                         ` João Távora
2023-04-18 23:05                                           ` Dmitry Gutov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALDnm539_QTPiM1Q6XJZauM_o9p_Gw2XQUpn25+5Heq7uxbwzQ@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=62029@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=dmitry@gutov.dev \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.