From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sergey Vinokurov Newsgroups: gmane.emacs.bugs Subject: bug#69952: [PATCH] Support pdumping compiled queries by dumping their source Date: Sat, 23 Mar 2024 12:53:37 +0000 Message-ID: <61a44fd0-289c-4eed-aa04-05b34617f10f@gmail.com> References: <86r0g1zaqi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11817"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 69952@debbugs.gnu.org, Daniel Colascione , Yuan Fu To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 23 15:42:58 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 1ro2aH-0002q5-OT for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Mar 2024 15:42:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ro2Zl-0002a5-Rz; Sat, 23 Mar 2024 10:42:25 -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 1ro2Zi-0002Z0-6S for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2024 10:42:22 -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 1ro2Zh-0003jn-UR for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2024 10:42:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ro2aM-00011F-32 for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2024 10:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sergey Vinokurov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Mar 2024 14:43: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.17112049603847 (code B ref 69952); Sat, 23 Mar 2024 14:43:02 +0000 Original-Received: (at 69952) by debbugs.gnu.org; 23 Mar 2024 14:42:40 +0000 Original-Received: from localhost ([127.0.0.1]:33032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ro2a0-0000zy-32 for submit@debbugs.gnu.org; Sat, 23 Mar 2024 10:42:40 -0400 Original-Received: from mail-wr1-f50.google.com ([209.85.221.50]:51414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ro2Zy-0000za-31 for 69952@debbugs.gnu.org; Sat, 23 Mar 2024 10:42:38 -0400 Original-Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-33e17342ea7so1452075f8f.2 for <69952@debbugs.gnu.org>; Sat, 23 Mar 2024 07:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711204851; x=1711809651; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pZuBjUYub6pT+uGj05XvbJfbCOYVtrJVYWy225Fo5qM=; b=eb0S13tTSq2K+lDNVikSLOXRFWCVFUCd45OtmSi5PyDKagXiFLqWNu1ylAkjXbQIKN RHOCzbQLVSS3/SQnokq9UBt1/WOXTaBRUxs/Y5LLxmw7scIGM0ynRSHKMXQPZRQXvGbg t8kK2VL2p3MM0jkx/WKiRB5xAyqJJpfw9JvJm+7UpU7mOEAdm4kxlS/gEzKykfrAG8W3 NFRYbMAxVpJi676vEMZmiNJmIexW4AnZtt8vWtl5ix0n3Lk9Zb9Cljd6p4KFYL9/K/9R IavYlSCJ5o6+D8vOEic2sOiS2XRIeAxB1P5hhbQH8XkVSdWRF8279v9s9dVCFaAvrlOe ysfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711204851; x=1711809651; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pZuBjUYub6pT+uGj05XvbJfbCOYVtrJVYWy225Fo5qM=; b=f5pyuvD/2f2LqaAA9ucDAK4gmv8BxqnbN8P4A40a1BLfhV7s3axid/atXZG7Thy/vU e8SMTl4Esj+021BcByHLrzz28kbtR7VnSBsoNmAoVVtlzkTODTXWr+PW0XV97AjShpUk NgahkFUQHlmPrJ1rYghmdPlERoN9V5kkFq9pkU1kiOiQT2FcUMUUrX/otLyvTiIuAHLQ mNVv/5RDr67FJXn/7492sJlmzaoNmDHQcH4G13GMwMsurqiDKPNtUe1bB+zse4ea/V5v Qi2HMs0FmkupdBsA6dp31CHk/EjUCVz1bqerCkodY5b28lgpkaqaKzM2ZLLyBAVpgwav jtsw== X-Gm-Message-State: AOJu0YwC7my4lIHV5FC9uKFN/xbvvkqqfK5qWooUmI/yleNXVmgVukkr IpQBKf7C45s+94cWs9qikbUzNBLg6x67R2bAVAXBt923U+VgwTg7vNcknbCSmHN1kBn/ X-Google-Smtp-Source: AGHT+IEOqRLbvZxY0FlUadFD4M0Fva0lPo6g4u+5itiwvqPfNIXc5YMi9EroxkTDGSr3O4T708RBLw== X-Received: by 2002:adf:e011:0:b0:33e:c604:dd50 with SMTP id s17-20020adfe011000000b0033ec604dd50mr1425203wrh.51.1711198417920; Sat, 23 Mar 2024 05:53:37 -0700 (PDT) Original-Received: from [192.168.1.107] ([152.37.81.238]) by smtp.gmail.com with ESMTPSA id b10-20020a05600003ca00b0033d640c8942sm4425042wrg.10.2024.03.23.05.53.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Mar 2024 05:53:37 -0700 (PDT) Content-Language: en-GB In-Reply-To: <86r0g1zaqi.fsf@gnu.org> 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:281985 Archived-At: On 23/03/2024 07:08, Eli Zaretskii wrote: >> Date: Sat, 23 Mar 2024 03:27:18 +0000 >> From: Sergey Vinokurov >> >> This patch aims to allow more things to be dumped. In particular, >> compiled treesitter queries can be easily dumped by storing their source >> so that they will be recompiled on load. >> >> I noticed that in my config compiled quires are created somewhere which >> prevents me dumping with standard Emacs build. But with this patch I can >> dump successfully and not bother finding out who produced the queries. >> >> It seems like there should be no drawbacks in allowing more things to be >> dumped, please correct me if I'm wrong. > > Thanks. I added Daniel and Yuan to the discussion, in case they have > comments. > > 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. According to c2ecb08775dc24618de507d2d1ce0f9b0debe17e, treesitter queries are compiled lazily on fist use. When loading dump file in an Emacs with missing grammar library the user should encounter an error on first use of the query. Quick testing shows that dump file can be loaded even with grammar definitions removed. Compiled queries are still there in elisp and there's no error during load.