bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41531: 27.0.91; Better handle asynchronous eldoc backends


From: Dmitry Gutov
Subject: bug#41531: 27.0.91; Better handle asynchronous eldoc backends
Date: Tue, 26 May 2020 02:52:58 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 25.05.2020 20:04, João Távora wrote:
Hi Stefan, Dmitry, Andrii and maintainers,

Moving the discussion that started in
https://github.com/joaotavora/eglot/pull/459  to the bug tracker, and
attaching the two patches that contain what I think is a decent
short-term solution to the eldoc/async problems.

Here's a modified approach that doesn't use a global var and should make it easier to transition to using futures.

Patch attached. Example of usage:

(add-hook 'eldoc-documentation-functions
          #'test-eldoc-async 0 t)

(defun test-eldoc-async ()
  (cons :async
        (lambda (cb)
          (funcall cb "doc here!"))))

If you like, we could simplify the returned objects to be just FETCHER (as documented in the patch) rather than (:async . FETCHER). But the latter seems more explicit.

There also exist a possible modification of this patch with a bit of functional programming where both calls to eldoc--handle-multiline happen from inside of eldoc-documentation-default's definition.

Attachment: eldoc-async-with-lexical-callback.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]