all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Stefan Kangas <stefan@marxist.se>, 50906@debbugs.gnu.org
Subject: bug#50906: xref-find-references blocks Emacs: asynchronous operation?
Date: Tue, 05 Oct 2021 07:18:18 +0200	[thread overview]
Message-ID: <AM9PR09MB497703C8016610E753B286B396AF9@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <152761c7-d793-2fa5-430f-d018c4957f89@yandex.ru> (Dmitry Gutov's message of "Tue, 5 Oct 2021 04:59:29 +0300")

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 30.09.2021 01:49, Stefan Kangas wrote:
>> Severity: wishlist
>> `xref-find-references' blocks Emacs while searching for matches.
>> This can take a long time to complete in large repositories.
>> It would be nice if it could work asynchronously, like e.g. `M-x rgrep'.
>
> Wishlist indeed!
>
> Daniel's bug report shows a good case for this kind of feature: huge projects
> where the search, even using fast tools (e.g. ripgrep), takes multiple
> seconds. So if results of such searches could be displayed incrementally, it
> would improve the perceive speed and usability.
>
> What can be done here:
>
> - Design an "asynchronous" format for xref-show-xrefs-function to
>   consume. FETCHER of a different shape. Not sure how it's going to work in the
>   end -- maybe a simple-ish iterator (call a function again for more results),
>   but ideally it would look synchronous somehow, and the concurrency would be
>   achieved through the use of threads. Not sure if that's realistic.

Built-in threads are not realistic, what you probably want is async processes. I
was myself thinking of something for finding all references for implementing
this asynchronosly for help, in style of , but I have not yet come to implement
that. However I have looked at native comp, 'comp-run-async-workers' and how it
processes it's qeue. I have no idea if it can be somehow adapted/reused, but
something like that at least as an idea.

> - The new kind of fetcher would need to provide a way to abort the search, since
>  'C-g' would not be available anymore.
It depends on how you would use it. If you would scan for references in the
background than you would be working with something else and wouldn't need
C-g. But reading your writing, something tells me that you would like to use it
interactively, which means you would start a *synchronous* operation, which
would use async workers, a lá Java's or MFC's thread workers to get responsive
and visible updates in real-time, while workers are still searching. In that
case you would still have C-g avaialable. On C-g you could signal worker
processes to quit.

Perhaps ...? :)





  reply	other threads:[~2021-10-05  5:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 22:49 bug#50906: xref-find-references blocks Emacs: asynchronous operation? Stefan Kangas
2021-09-30  7:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-05  1:59 ` Dmitry Gutov
2021-10-05  5:18   ` Arthur Miller [this message]
2021-10-05 15:11     ` Dmitry Gutov
2021-10-05  6:29   ` Helmut Eller
2021-10-05 16:38     ` Dmitry Gutov
2021-10-05 18:09       ` Helmut Eller
2021-10-05 19:24         ` 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=AM9PR09MB497703C8016610E753B286B396AF9@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=50906@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=stefan@marxist.se \
    /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.