From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.bugs Subject: bug#50906: xref-find-references blocks Emacs: asynchronous operation? Date: Tue, 05 Oct 2021 07:18:18 +0200 Message-ID: References: <152761c7-d793-2fa5-430f-d018c4957f89@yandex.ru> 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="38392"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Stefan Kangas , 50906@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 05 07:19:19 2021 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 1mXcrG-0009lk-Ce for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 07:19:19 +0200 Original-Received: from localhost ([::1]:57300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXcrE-0002wv-VZ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 01:19:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXcr0-0002wX-53 for bug-gnu-emacs@gnu.org; Tue, 05 Oct 2021 01:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXcqz-00084u-RB for bug-gnu-emacs@gnu.org; Tue, 05 Oct 2021 01:19:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mXcqz-00077g-LP for bug-gnu-emacs@gnu.org; Tue, 05 Oct 2021 01:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arthur Miller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Oct 2021 05:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50906 X-GNU-PR-Package: emacs Original-Received: via spool by 50906-submit@debbugs.gnu.org id=B50906.163341111227338 (code B ref 50906); Tue, 05 Oct 2021 05:19:01 +0000 Original-Received: (at 50906) by debbugs.gnu.org; 5 Oct 2021 05:18:32 +0000 Original-Received: from localhost ([127.0.0.1]:38798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXcqW-00076s-Fn for submit@debbugs.gnu.org; Tue, 05 Oct 2021 01:18:32 -0400 Original-Received: from mail-oln040092069013.outbound.protection.outlook.com ([40.92.69.13]:20486 helo=EUR02-VE1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXcqR-00076c-Ut for 50906@debbugs.gnu.org; Tue, 05 Oct 2021 01:18:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9PYzjVlQ4gv5/+0ZI+/5c4s7zcMP8KdjcuTXTFmnlciAK1OPyjW+DFPE0oF6lHmkc2Uun47QBka6f6RAf13qSLVW1aF0WM9lEvxm8saiP37zadGo+au1rd5pKAtbPXce5/+HxSwspnt5alWo+ws1NJsRPRkSlheO6yN3Jz3LZT3kNY5FOaap4Bo6IijYdh0ikgldj9DDHTkJx6b3sibXz4y27qutw6yxC8Yf4NmbwZxjJACJPR6RbG7AevgdgTSNMmdoCHWOPxTYC0OwlcHAmAYu9NrpG7wdw1o47Xz+Joiq/UnlG3eiAyBZ7Y1v/Ppp+BejGwcTdza17Wya3W9nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xtboF4GCv9E4T3ZVYnd7lrW1n7uHEvWqL3JE3he/2RM=; b=NxukbCZQDCDC+q2ZKoUeaxPST6yOzFqmuQl7Vq/PLK48oxF9mKI5itYl8KhIZCccWg5GuVJE7j86Fp0lGWApdo3MWrQnebYqmFoY0s9DdEf6U/glhefyncr16AvoeehFQd6qf+j5Wa1drAoxF2iycr/KBFZeFCi7wyWl3+GxE/wYHvAg+cESiAm46iwRsMqrx5atbmpfeFj8lLiBq5m0bjxQQxOvI6N/EDQemUCfndSTCQ/eUbulFR9UYMGnYzW9FXGMtix58reP5jPvfHc+sdeOiNcNlrFgIPBjIYj8yUWUUrr1Zyvp3vPxoRGsGy9Uqjr7OOpeJ+aAQ1A+8OJ78Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xtboF4GCv9E4T3ZVYnd7lrW1n7uHEvWqL3JE3he/2RM=; b=SfVH1787DAoLiIYupY6CJdmSSGKqFzt8pHHlhe0szJVqJWp68iHpQtFFldH18D9S12Rpg1HhTMd3qb4GueYUUugjHU1Zpu/zFIYKuRj5rVEsBifhTS3GnRP1rNtmP5kp4/V8Ty4MO8eyLFRfjkcHto4o8yNIQDrnFMDfFNzsZiS4wXyQc2LFkltHlOel85xttgShf/+FgGs7CfK+eO/7X/BL0oGQeIEmyHRD0Csf1F3+f3ZGvKdgbGbHh7vfvqWLwITNLUBqGGLpykZi45ZyIGXh60x/bbA1WxsnryFiAprN77m7+RyoAb2ZVKAiN/ESxxZY7LrqC6mJARYuwFg3Lg== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM9PR09MB5011.eurprd09.prod.outlook.com (2603:10a6:20b:30d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15; Tue, 5 Oct 2021 05:18:20 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2%9]) with mapi id 15.20.4566.022; Tue, 5 Oct 2021 05:18:20 +0000 In-Reply-To: <152761c7-d793-2fa5-430f-d018c4957f89@yandex.ru> (Dmitry Gutov's message of "Tue, 5 Oct 2021 04:59:29 +0300") X-TMN: [3g4EGBDudTghFc5kuldAG0le+GoNRdpz] X-ClientProxiedBy: HE1PR02CA0091.eurprd02.prod.outlook.com (2603:10a6:7:29::20) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87mtnouk11.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1PR02CA0091.eurprd02.prod.outlook.com (2603:10a6:7:29::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Tue, 5 Oct 2021 05:18:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d622e21-5819-4f58-397e-08d987bf8bbe X-MS-TrafficTypeDiagnostic: AM9PR09MB5011: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EN51Ogm8+U7gNAk3gpMRN6fUAaBvRl960pNR/e4jSPtRbC8uENXyqzho338fR14JGxs5q3BYFm8SQlRXAdf81KgGF/ANFjPd/L9hrG0rc9/mgW1V8BLp9xN53g/JtB8vBsIvMv2Qwoyl+GcOWghV2OBC3lmHxOLec3DWmi+XfXo/76GtI6IBLocvsARUvJVPvo38qRBJ/BOCuH+RrePE0KpMdk3atXBbIHR32xltyLYS3xyJVIydXlU/nEiXN4GsAK/QBY0kZMAuGC9cdXx2Z4F8Ue3Is5GrYMKXeh75m7R9YxOS55AchT+LBD2G37IQOfg8EU4vzDL2Jx6UAC9gRTnPSD1trv5sSEk7ffipTGaYEVYuhIeCY/x3tPusPWsDlfImvov5jWvY9TC+uc2eeq58LLWHVBTSGEOUgdxE06nRcYfdbHhZfFTgarBf9WLX X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z6/rj7v+VI921G/fYhbNuHmUQQgFZmVmc36NQOX/86Jzrhvvn0RSjrUKGxd527AfLEkBydd027hZNSf5YY3+TjCWIoSYCeN6OynumTpNMCTYUSx6p+UUo0ktKvCtwGfg+PwFITNlvxfPUWjNW6kX7Q== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 3d622e21-5819-4f58-397e-08d987bf8bbe X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2021 05:18:20.7119 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR09MB5011 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:216410 Archived-At: Dmitry Gutov 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 proj= ects > 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 resu= lts), > but ideally it would look synchronous somehow, and the concurrency woul= d 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 process= es. I was myself thinking of something for finding all references for implementin= g this asynchronosly for help, in style of , but I have not yet come to imple= ment that. However I have looked at native comp, 'comp-run-async-workers' and ho= w it processes it's qeue. I have no idea if it can be somehow adapted/reused, bu= t 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 us= e it interactively, which means you would start a *synchronous* operation, which would use async workers, a l=C3=A1 Java's or MFC's thread workers to get re= sponsive and visible updates in real-time, while workers are still searching. In tha= t case you would still have C-g avaialable. On C-g you could signal worker processes to quit. Perhaps ...? :)