From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69952: [PATCH] Support pdumping compiled queries by dumping their source Date: Sun, 21 Apr 2024 07:53:46 +0300 Message-ID: <86frvf8gf9.fsf@gnu.org> References: <86r0g1zaqi.fsf@gnu.org> <86le5hr9oj.fsf@gnu.org> <861q709y5y.fsf@gnu.org> <9B2A2190-AB42-4F1B-9F9D-5623B343CF0A@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2062"; mail-complaints-to="usenet@ciao.gmane.io" Cc: serg.foo@gmail.com, dancol@dancol.org, 69952@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 21 06:55:03 2024 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 1ryPEF-0000Iz-JJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Apr 2024 06:55:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryPE0-00085r-P4; Sun, 21 Apr 2024 00:54:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ryPE0-00085g-0u for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2024 00:54:48 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ryPDz-0003cS-OB for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2024 00:54:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryPEE-0002Sd-QI for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2024 00:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Apr 2024 04:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 69952-submit@debbugs.gnu.org id=B69952.17136752538956 (code B ref 69952); Sun, 21 Apr 2024 04:55:02 +0000 Original-Received: (at 69952) by debbugs.gnu.org; 21 Apr 2024 04:54:13 +0000 Original-Received: from localhost ([127.0.0.1]:40562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryPDQ-0002KM-Kv for submit@debbugs.gnu.org; Sun, 21 Apr 2024 00:54:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryPDO-0002Je-Nn for 69952@debbugs.gnu.org; Sun, 21 Apr 2024 00:54:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ryPD2-0003XA-Rw; Sun, 21 Apr 2024 00:53:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=KGMIuoAF1wknQqzu6+w1zhx+LNRIzYwuwX+5u8v52U0=; b=O7z5z0fGGhmcmJHdGx9d VoST5qFAWhWyu3UPcEivdrrzQIBHhBO4Ae3LvoJ6ETC17MgAVH//gVgyTntZWN4WVBUowSLNACGHo XUbFPDk83Dyab6pz27gUDfsZUjLnfOlIJj6IhWFuQ8OaVND4nBQcUQkljRgN02OeaFp36F7XhbnIH FkBaZ5xolhkg6NjTtNrVveiFGiWxx9dhP3nKPjBNMVuVCPubjV4h6s0J/GPxwXQBkzsgrOtB/vWiT Cs2C6wOcVztA2nRi0TT6TcNPTdtDTG4yHDuC/q5L24y19TK9kTWK30/j+No83NZjfMQjW/AsChTTV 4TKzYBcirk9H7w==; In-Reply-To: <9B2A2190-AB42-4F1B-9F9D-5623B343CF0A@gmail.com> (message from Yuan Fu on Sat, 20 Apr 2024 15:50:36 -0700) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283756 Archived-At: > From: Yuan Fu > Date: Sat, 20 Apr 2024 15:50:36 -0700 > Cc: Daniel Colascione , > serg.foo@gmail.com, > 69952@debbugs.gnu.org > > >>> On Apr 13, 2024, at 12:41 AM, Eli Zaretskii wrote: > >>>> > >>>> And I have a question: what happens if the pdumper file dumped with > >>>> tree-sitter available is loaded by an Emacs session in which > >>>> tree-sitter is not available? That can happen on Windows, for > >>>> example, if the tree-sitter library or the grammar library required > >>>> for recomputing the query is not available. I think we need some code > >>>> to prevent Emacs from crashing on startup in that case. > >> > >> Yeah, being able to dump queries is certainly nice. There will be problems if the Emacs session that later loads the query either have a different grammar version loaded, or a difference grammar library for the same language, or outright doesn’t have tree-sitter like Eli mentioned. I don’t know if they are big enough problems to give up dumping queries, though. > > > > Giving up: no. But I think the code which loads the queries from the > > pdumper file should be protected from crashing in those cases. Can > > you suggest how to do that? > > Would Emacs crash? If the dump file just contains the query (which is a string), then Emacs would just compile the query with treesit-query-compile, it could fail (due to the reasons I mentioned), but shouldn’t crash Emacs. Can Emacs compile a query if the tree-sitter shared library and/or the grammar library is not available?