Received: (at 72388) by debbugs.gnu.org; 31 Jan 2025 07:06:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 31 02:06:11 2025
Received: from localhost ([127.0.0.1]:49427 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tdl6R-000519-A0
for submit <at> debbugs.gnu.org; Fri, 31 Jan 2025 02:06:11 -0500
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:37753)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tdl6O-00050b-Gq
for 72388 <at> debbugs.gnu.org; Fri, 31 Jan 2025 02:06:09 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 955B444338;
Fri, 31 Jan 2025 07:05:59 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Ergus <spacibba@HIDDEN>
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
In-Reply-To: <7lqdueif7ho7su6ck253umrv22uwpzc6trnv4u6wns47mx6u2o@6wfrrco7zx4j>
(Ergus via's message of "Fri, 31 Jan 2025 01:06:06 +0100")
Organization: LINKOV.NET
References: <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
<psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
<17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN>
<0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
<6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
<88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN>
<flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54>
<664A137C-90A8-4ADD-AE6F-F89E18D7FFEF@HIDDEN>
<rnkb7clrqocwcszhenope2deift4ud7n7e3pnyhkb4mftax227@ksfmppd4af7z>
<779AFCB2-62B0-4CE9-90B2-E979CDDB552D@HIDDEN>
<7lqdueif7ho7su6ck253umrv22uwpzc6trnv4u6wns47mx6u2o@6wfrrco7zx4j>
Date: Fri, 31 Jan 2025 09:05:35 +0200
Message-ID: <87bjvnxyjc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: 0
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekuddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecunecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopeefpdhrtghpthhtohepjedvfeekkeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegtrghsohhurhhisehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhprggtihgssggrsegrohhlrdgtohhm
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
> When c-ts-mode-enable-doxygen is enabled and the cursor moves inside a
> doxygen comment I get this error:
>
> Debugger entered--Lisp error: (treesit-predicate-not-found ("Cannot find the definition of the predicate in `treesit-thing-settings'" list))
> (treesit-parent-until #<treesit-node description in 7380-7452> list)
> (treesit-show-paren-data--categorize 7376)
> (treesit-show-paren-data)
> (show-paren-function)
> (apply show-paren-function nil)
> (timer-event-handler [t 0 0 125000 t show-paren-function nil idle 0 nil])
>
> If you prefer I can open a new issue for this, but maybe it is not needed.
This is a separate issue: bug#75198 (closed) and bug#75456 (still open).
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.Received: (at 72388) by debbugs.gnu.org; 31 Jan 2025 00:20:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 19:20:48 2025 Received: from localhost ([127.0.0.1]:48407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tdem7-0004wq-Pz for submit <at> debbugs.gnu.org; Thu, 30 Jan 2025 19:20:48 -0500 Received: from sonic315-14.consmr.mail.bf2.yahoo.com ([74.6.134.124]:45027) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1tdem4-0004wZ-J6 for 72388 <at> debbugs.gnu.org; Thu, 30 Jan 2025 19:20:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1738282838; bh=tDHF/Rlvi5FIhrSgCZ1H/QQWz66Pt70UBfs0DIqucsw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=oJetm+K/GWN7dUWJkcQrC/YjIl7597VgRRfx0QdCrGY5kCV7NhwWyglUcgodGEXDxCtgerxWtES8jQXbbSglzqbiZ3J4SSKBSJSx0DrN+oon4/bNGjATyV4o/OTIiOlPyj/pjbd8A5iKWFzodta0GFGQXJUkkyvlPFb1OPHvvUzYQMyP54yeWNb9oJ8iySsXF5GWXDjoMBSD5tq73LOoh2v7DsVYdK5t2EWPDDwdE9TTayDrwObRFkRHan56bdH7JSNKVlt7RfByiUb1nxBFE1pSCoX1XESzI6si50Pv8bNu2cG8YOMC4RIvbaqdxqXgLFILjw156DZqvzotqzUFZw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1738282838; bh=L6EuMId4AD99Pztw/eOuIQnSpp6aC/nprwmBV9Fjc1u=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=FZN5JWhfh2HLPbu6dPzmUumduXmIvf1TpT/Yd23+RRBumuucCPsWuqTF3+9O019n21HiM7+NjZPbPyJQ7BSDZ40hM1uq9Z4ZuQD3JV/UW6qV4XbKS5SX5QwUjwZFgDoVrkOvSwIf4Thv+X+/OuIqY7YIMc4L1huk37EIOXuCXnZqtw98IQMTBAd/IvKv8c7iiPpDDHdvR6jIxh1QMhemR0VvBiyaTodkWocphbEe5qb9aoyTerAhGITmtq/NsvWPqeaFC/3I9z/ho59UHKW0yGm3EM31H+YOFMZXjuJrqCMHxuD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IavAXCrTJgt7FFv_Mt7wHKewU9SsAZN bT6F3MTnxy5BwDvAOfmmm4dZ.PjjFQSgph7CI2ePN2zvIptKCUgnzNo3UDn5txv4Zia5GOVt6JLL HO4nSxo9Pl2NWng71HKl0oriDVM7kkUkDBQB56vyrnCibM5cqZAYgT.gcUEazECWo.RN7tDa.SHK bYsM- X-Sonic-MF: <spacibba@HIDDEN> X-Sonic-ID: 875a7897-a88d-44e4-9f18-d1858f8a0f8b Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.bf2.yahoo.com with HTTP; Fri, 31 Jan 2025 00:20:38 +0000 Received: by hermes--production-ir2-c694d79d9-5hgbf (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID e68ff6cae38f5cd804b4a55498122161; Fri, 31 Jan 2025 00:20:34 +0000 (UTC) Date: Fri, 31 Jan 2025 01:20:32 +0100 From: Ergus <spacibba@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules Message-ID: <wtrmu26frcfykwtpfxxbc67nlya36hm6lv4ewsqw2ioqiyrshq@twgmoerzfhgz> References: <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN> <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq> <17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN> <0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN> <6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb> <88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN> <flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54> <664A137C-90A8-4ADD-AE6F-F89E18D7FFEF@HIDDEN> <rnkb7clrqocwcszhenope2deift4ud7n7e3pnyhkb4mftax227@ksfmppd4af7z> <779AFCB2-62B0-4CE9-90B2-E979CDDB552D@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <779AFCB2-62B0-4CE9-90B2-E979CDDB552D@HIDDEN> X-Mailer: WebService/1.1.23187 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Content-Length: 1055 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72388 Cc: 72388 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Yuan: Another detail. I just detected that when I call treesit-inspect-node-at-point I always get No node at point However: (treesit-node-at (point)) provides right information. On Wed, Jan 29, 2025 at 11:27:59PM -0800, Yuan Fu wrote: > > >> On Jan 21, 2025, at 10:23 PM, Ergus <spacibba@HIDDEN> wrote: >> >> Hi Yuan: >> >> When I try your patch I get an error: >> >> Debugger entered--Lisp error: (treesit-no-parser cpp) >> (treesit-buffer-root-node cpp) >> (treesit-node-at 3091) >> (treesit-show-paren-data--categorize 3091) >> (treesit-show-paren-data) >> (show-paren-function) >> (apply show-paren-function nil) >> (timer-event-handler [t 0 0 125000 t show-paren-function nil idle 0 nil]) >> >> When I try: >> (treesit-parser-list nil 'cpp) -> nil >> >> So it it like the >> >> I tried manually (setq-local treesit-primary-parser >> (treesit-parser-create 'cpp)) >> >> but nothing. > >Apologies, the previous change I made is indeed insufficient. Please try the latest master, the remapping should be truly transparent now. > >Yuan
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 31 Jan 2025 00:06:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 19:06:24 2025
Received: from localhost ([127.0.0.1]:48391 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tdeYB-0004Jo-Qb
for submit <at> debbugs.gnu.org; Thu, 30 Jan 2025 19:06:24 -0500
Received: from sonic309-15.consmr.mail.bf2.yahoo.com ([74.6.129.125]:36883)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1tdeY9-0004Ja-2X
for 72388 <at> debbugs.gnu.org; Thu, 30 Jan 2025 19:06:22 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
t=1738281974; bh=1GeEO2H6zkCuirV50M4qg0wwP8ZkDtyX+ca3LMpbMpg=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To;
b=qvOQvy2LtNz7bDp/jyH7fg6UhxVY/C/lAPxyADGwFKp0Z6MnaZU7EwliB+0GFcUtzRK8qsiNnZsDg9eWHxikZejY6Z7qu6hXdVEXEGt3/jBhbsBc9Rca9a4ZhlNu46JIT4sAYuyQTyPY2guuY0nr9/CBu0HHCBwAq8n9eLr35+UWJYQ7ThvWYfVBN7f7XgyUA7k+7yvxg1mmt0v1LPBf9szdeDG5bEAl5IqIeR9zFBLly+kBmLIo1t5FJsB8FRpNRh1+6VInUbeLhv4k/P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Aatk09KBfS40BZDG2yEzEfZA8YGKyXE87
Y9wxS.2hVCSiEhOnEj_4MvbriRw25RCmTRpYx5hCrfaE_ysfvHvD_nUCL6MuNzUIOWOZsg0_GDlT
WTaVoqaGo9U42nGDwa9Jz6j82zfcz94kDdoQXqezP1O_51TlxlZ42z4prNhmaaF_bcMEvB9SdT17
B..c8zEWHJW6_11PQ2OGri0Ia2jyJbilJApSmijCpZ2ZcSqg8XY9g_F2dbY7.5g8rMF_IZM8GAqE
ZOBCn_jSp_AUG1fpRw6HXv10AumDLvfV.QSdaXehGkASO2yqui8qHb4Vu3Zylpv9zFro1PgNXQk1
WZfReVWBWwUd.PANeEABSunHLJBpX1dcQ1qlIb67vpAvDevOkSvPkAs83Q2t.eDrnLW_j0TylAj3
xYAimNCuSYEL9PHpCVLzy0ivjog.nTFfY3EQtNF9UGZIKR8E1Ejvf09FEzOH_hkosnrWFTD3UoaM
K9pex65mnefTLXqHrgVjT1QjfE8ZIBmNEHeSfJxNb7JawbqvG._XkPBxSqcUkwrQLhPJoYtXguSY
7Kdmi8SakZVam1D8hjZ9ABXrbFXJpaJxV36FkynxMF7ijJV5APqyRxu8k61NkLRvTST.XeCWp_wj
Ae0ymN0RCgFpxKxrlBatVcySzBIjSjpIDttVH8W_YyLhW.u1.P7.yiLA0mRXEx61.0_WvGexIbSm
hmvszjdPS
X-Sonic-MF: <spacibba@HIDDEN>
X-Sonic-ID: 27447bd8-4058-4c55-95f6-a5d2b6b178ac
Received: from sonic.gate.mail.ne1.yahoo.com by
sonic309.consmr.mail.bf2.yahoo.com with HTTP; Fri, 31 Jan 2025 00:06:14 +0000
Received: by hermes--production-ir2-c694d79d9-mr45v (Yahoo Inc. Hermes SMTP
Server) with ESMTPA ID 7901e9f47674a51f20f3d16c633f2541;
Fri, 31 Jan 2025 00:06:08 +0000 (UTC)
Date: Fri, 31 Jan 2025 01:06:06 +0100
From: Ergus <spacibba@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
Message-ID: <7lqdueif7ho7su6ck253umrv22uwpzc6trnv4u6wns47mx6u2o@6wfrrco7zx4j>
References: <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
<psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
<17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN>
<0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
<6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
<88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN>
<flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54>
<664A137C-90A8-4ADD-AE6F-F89E18D7FFEF@HIDDEN>
<rnkb7clrqocwcszhenope2deift4ud7n7e3pnyhkb4mftax227@ksfmppd4af7z>
<779AFCB2-62B0-4CE9-90B2-E979CDDB552D@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <779AFCB2-62B0-4CE9-90B2-E979CDDB552D@HIDDEN>
X-Mailer: WebService/1.1.23187
mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 1739
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hi Yuan:
The cuda mode seems to work now. I am still testing and fixing details,
but so far now it works.
However I have detected another issue that I thought was related with
the remap, but it is not because I got it also in normal c++-ts-mode:
When c-ts-mode-enable-doxygen is enabled and the cursor moves inside a
doxygen comment I get this error:
Debugger entered--Lisp error: (treesit-predicate-not-found ("Cannot find the definition of the predicate in `treesit-thing-settings'" list))
(treesit-parent-until #<treesit-node description in 7380-7452> list)
(treesit-show-paren-data--categorize 7376)
(treesit-show-paren-data)
(show-paren-function)
(apply show-paren-function nil)
(timer-event-handler [t 0 0 125000 t show-paren-function nil idle 0 nil])
If you prefer I can open a new issue for this, but maybe it is not needed.
Best,
Ergus
On Wed, Jan 29, 2025 at 11:27:59PM -0800, Yuan Fu wrote:
>
>
>> On Jan 21, 2025, at 10:23 PM, Ergus <spacibba@HIDDEN> wrote:
>>
>> Hi Yuan:
>>
>> When I try your patch I get an error:
>>
>> Debugger entered--Lisp error: (treesit-no-parser cpp)
>> (treesit-buffer-root-node cpp)
>> (treesit-node-at 3091)
>> (treesit-show-paren-data--categorize 3091)
>> (treesit-show-paren-data)
>> (show-paren-function)
>> (apply show-paren-function nil)
>> (timer-event-handler [t 0 0 125000 t show-paren-function nil idle 0 nil])
>>
>> When I try:
>> (treesit-parser-list nil 'cpp) -> nil
>>
>> So it it like the
>>
>> I tried manually (setq-local treesit-primary-parser
>> (treesit-parser-create 'cpp))
>>
>> but nothing.
>
>Apologies, the previous change I made is indeed insufficient. Please try the latest master, the remapping should be truly transparent now.
>
>Yuan
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.Received: (at 72388) by debbugs.gnu.org; 30 Jan 2025 07:28:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 02:28:21 2025 Received: from localhost ([127.0.0.1]:44114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tdOyK-0004zG-JO for submit <at> debbugs.gnu.org; Thu, 30 Jan 2025 02:28:20 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:50243) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1tdOyH-0004yx-UU for 72388 <at> debbugs.gnu.org; Thu, 30 Jan 2025 02:28:18 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-216426b0865so7340705ad.0 for <72388 <at> debbugs.gnu.org>; Wed, 29 Jan 2025 23:28:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738222092; x=1738826892; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mgedZrsG6AzYh+2Zk3/MijgtCOa3o1Pe/4yD8BInmk4=; b=UwIxO3zxFf8Mr7/rNlQFdkUSR5Eoj2yaH1T8NkMMEaHt4jAND47QL8//MWouUgcWfy 06aY0DeO1bYyzd3z9XeoIP148jpNArTmGkBz5V9hrxnXCUCE+dzoxCgovIUizRVsr2FL aMq/3amf/3ZugHVtX5ZrmoxihvmoxBigQStfs+dD/07D6V+MbxFEPtoPvPaTdfR5xOv6 3mjaySg+tDCKOVqIUh13gtbFNvfuud+Wr7dtZDF73Xg6gFx+yroikP39rSOAjALkcbW6 tfz3fPde2VJjvRzmAdwSa+OF08CCvpd1DLSeLPyfFkwBzq52ikNOZboK+7i/mTFhBIbT w2dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738222092; x=1738826892; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mgedZrsG6AzYh+2Zk3/MijgtCOa3o1Pe/4yD8BInmk4=; b=xUHF8Ug0o+fOZHxrJdlSqs23Gq5jDL4ItYDMJ9e0XdjD+BIwmtEjAp9Gv9JY18vDPo Z3QzY6eewJ3NPK4ffz6az1va+NOcseoP06oVkzGtoLZRkGEuJw/NB6v+oRY9v/CjUjIW QL3D5ht0zt6kRPKo7BmMkof8LS5FPAR43xXjqEs6jAlVG5AopnA/HFfcRwExGsU001zO lsbQMCgxGujD1ps1DGuU9+OcUrqAtFTAnzqnSmSeuZ6wat1kVcB0ctBbel2cbiGd3DBY MUB761Waoo7CPEnoHp53UBJEK6L4ZkRcE0iwCO6jMbHIguW+cQ4wPGAHmb2GLpYVnesw F2Bg== X-Gm-Message-State: AOJu0Yw+z1Wr6WE5Exz0jHiyx15n7z58MNMvkK7qF8hgpoYaMPXR6WLv cpmwxqH/nujaboUJKNgGseqUu2Ws1I4iDjMdQ8QGl6tdEHNhxjIw X-Gm-Gg: ASbGnculzbPZGtO5H61+81O9Ty/k5ypR40NVsfbwJZNluxNpPhHJEMIIP0bV4W00/Vs 3Eyd827g3ZmlLAltm2vtgQ657LkRlf97sMwKLqa+ESHFS8bQy+thKNH5oISaahZcibxI0XWcCAU 8jdlP6nHajVy901qxxVHzTY4fDQq0/xBxL0ywWeQojHndlbybNGtpInbfscHuD2QheI1fJarZLl 718UlwUYklZfzy7Lfx3YY5IBvF0vDvOdBlTlbTtUTl/FKLdzilXkeKMnH0yGKB9G2LXzOctEoi1 3ToxJPuceoYaYgd+RGyd58Bo21T6M8c+yGwWNm8= X-Google-Smtp-Source: AGHT+IGlTsAUFNiJE9+AyAmpQzaZp66ZXiasBf/wV2TQT8MxIr5lD3z7QTGadkjV4jjMOoCOatn5OA== X-Received: by 2002:a17:902:e541:b0:216:282d:c697 with SMTP id d9443c01a7336-21dd7da3eb0mr96922295ad.27.1738222091620; Wed, 29 Jan 2025 23:28:11 -0800 (PST) Received: from smtpclient.apple ([2601:646:8f81:6120:7458:916a:4e36:8381]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21de33206cdsm7444535ad.238.2025.01.29.23.28.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jan 2025 23:28:11 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <rnkb7clrqocwcszhenope2deift4ud7n7e3pnyhkb4mftax227@ksfmppd4af7z> Date: Wed, 29 Jan 2025 23:27:59 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <779AFCB2-62B0-4CE9-90B2-E979CDDB552D@HIDDEN> References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y> <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y> <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN> <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq> <17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN> <0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN> <6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb> <88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN> <flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54> <664A137C-90A8-4ADD-AE6F-F89E18D7FFEF@HIDDEN> <rnkb7clrqocwcszhenope2deift4ud7n7e3pnyhkb4mftax227@ksfmppd4af7z> To: Ergus <spacibba@HIDDEN> X-Mailer: Apple Mail (2.3776.700.51) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72388 Cc: 72388 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > On Jan 21, 2025, at 10:23=E2=80=AFPM, Ergus <spacibba@HIDDEN> wrote: >=20 > Hi Yuan: >=20 > When I try your patch I get an error: >=20 > Debugger entered--Lisp error: (treesit-no-parser cpp) > (treesit-buffer-root-node cpp) > (treesit-node-at 3091) > (treesit-show-paren-data--categorize 3091) > (treesit-show-paren-data) > (show-paren-function) > (apply show-paren-function nil) > (timer-event-handler [t 0 0 125000 t show-paren-function nil idle 0 = nil]) >=20 > When I try: > (treesit-parser-list nil 'cpp) -> nil >=20 > So it it like the >=20 > I tried manually (setq-local treesit-primary-parser > (treesit-parser-create 'cpp)) >=20 > but nothing. Apologies, the previous change I made is indeed insufficient. Please try = the latest master, the remapping should be truly transparent now. Yuan=
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 22 Jan 2025 06:23:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 22 01:23:43 2025
Received: from localhost ([127.0.0.1]:59258 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1taU9P-0003hZ-9k
for submit <at> debbugs.gnu.org; Wed, 22 Jan 2025 01:23:43 -0500
Received: from sonic314-15.consmr.mail.bf2.yahoo.com ([74.6.132.125]:32835)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1taU9M-0003hC-54
for 72388 <at> debbugs.gnu.org; Wed, 22 Jan 2025 01:23:41 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
t=1737527013; bh=Xyx13AOvRXFcY0BwAcCyV6MTwL1LlP4w1GgBYFdRqqA=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To;
b=H1KHf64Eg3sE8Yj7sVr8mf3RByu07CFEobvoOrhj6kmOPI4Rz6WePYBYC/ZjqKbmrV7AjYePEH3qIl3TMxZVQyiChAEiO29XwVDzA9vgyE8WUAMJZQqXLodudW4omqFWIWN7iZOhyni6AY6r0i6PZZCsSfSb+3eFLkYjuIUQtZd6kj3JEGwPZkcCfK19GsGWmbgf/jxLbHXxPffRvVF61Vkr4ZNvwjm3RqbeVmUjK5ir/Vr7L+kMUn2OQHj+twmxf5FiGSAt5U0RijIUsnnWw6oGZYx/Z23L8TJU1Y4MyexBj9aKBUcrptv76sL8xZhhB+Hm6tCA1pj7k208/FMxFA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1737527013; bh=gCrmH1YlQPFzeb6CNIKufF1swoB1jhbS1Z2RaRPvD2m=;
h=X-Son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Q7XYjWH7CU8KblfcWucXYoYvI.D8vxyiy3lqFv7q6rktwC78F_
WM4FHRxkKpPVdzekRw6IgEloMZh1rPxZh8qcTrOSdjknhqmWipHvJOmK8A5U9KQXcbbmb0XG66nm
FN8M3B73ZVDy85u4FlWgksmFQWOI_ToblNxnOnQ5_tFVCDMvdw0zhBuE2RoeccnuxW3Bqs2HUVBw
ZDZwdkvtNbu.BKlCicWM_zCgR_N4giTf54hKPRxcA2W76g3OhBFYUHGTVTmQ9zgb_68ryjGXAEa7
2q7ujvM0RMhcf.RJHFhWcKA2pUlOY2h87DBjXCe0QDNwCjCEQ9TumW9uLIzH_Xac6Nf8xZoPW8Un
Hipojpuktrgiug0bV2c1oEuwAWZYsX3dIIMPeEgg997ErXLXUoiACBJVHblf0JWDC8e7HvdsiNnU
H8juKfLdC0gCPgD56c8w.hxy.pvZL609QEf89M6ns0YDDGi2L2wpJuwMbCA_zMRXG0rjZBtuJGoN
5cv97_a2lzA--
X-Sonic-MF: <spacibba@HIDDEN>
X-Sonic-ID: 94195a46-604c-4a97-b2b0-c5c040737bfb
Received: from sonic.gate.mail.ne1.yahoo.com by
sonic314.consmr.mail.bf2.yahoo.com with HTTP; Wed, 22 Jan 2025 06:23:33 +0000
Received: by hermes--production-ir2-c694d79d9-mr45v (Yahoo Inc. Hermes SMTP
Server) with ESMTPA ID e6dfedf8a69aa4c7ffa3543b942c3d65;
Wed, 22 Jan 2025 06:23:30 +0000 (UTC)
Date: Wed, 22 Jan 2025 07:23:28 +0100
From: Ergus <spacibba@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
Message-ID: <rnkb7clrqocwcszhenope2deift4ud7n7e3pnyhkb4mftax227@ksfmppd4af7z>
References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y>
<j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
<1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
<psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
<17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN>
<0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
<6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
<88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN>
<flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54>
<664A137C-90A8-4ADD-AE6F-F89E18D7FFEF@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <664A137C-90A8-4ADD-AE6F-F89E18D7FFEF@HIDDEN>
X-Mailer: WebService/1.1.23187
mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 4667
X-Spam-Score: -0.1 (/)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.1 (-)
Hi Yuan:
When I try your patch I get an error:
Debugger entered--Lisp error: (treesit-no-parser cpp)
(treesit-buffer-root-node cpp)
(treesit-node-at 3091)
(treesit-show-paren-data--categorize 3091)
(treesit-show-paren-data)
(show-paren-function)
(apply show-paren-function nil)
(timer-event-handler [t 0 0 125000 t show-paren-function nil idle 0 nil])
When I try:
(treesit-parser-list nil 'cpp) -> nil
So it it like the
I tried manually (setq-local treesit-primary-parser
(treesit-parser-create 'cpp))
but nothing.
On Mon, Jan 20, 2025 at 03:29:45PM -0800, Yuan Fu wrote:
>
>
>> On Jan 20, 2025, at 9:09 AM, Ergus <spacibba@HIDDEN> wrote:
>>
>> Hi Yuan:
>>
>> Very thanks for your reply and patches :) I think I am bothering too
>> much :p
>
>No no, sorry, I didn’t explain it clear enough.
>
>>
>> On Sun, Jan 19, 2025 at 10:57:16PM -0800, Yuan Fu wrote:
>>>
>>>
>>>> On Jan 18, 2025, at 4:42 AM, Ergus <spacibba@HIDDEN> wrote:
>>>>
>>>> On Fri, Jan 17, 2025 at 05:29:00PM -0800, Yuan Fu wrote:
>>>>
>>>> Hi Yuan:
>>>>
>>>> Very thanks for your answer and quick fix ;)
>>>>
>>>> However when I try this:
>>>>
>>>> ```
>>>> (define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
>>>> (when (treesit-ready-p 'cuda)
>>>> (setq-local treesit-primary-parser (treesit-parser-create 'cuda))
>>>> (setq-local treesit-language-remap-alist '((cpp . cuda)))))
>>>> ```
>>>>
>>>> `treesit-simple-indent-rules' and `treesit-font-lock-settings' are nil.
>>>>
>>>> On the other hand:
>>>>
>>>> If I do instead:
>>>>
>>>> ```
>>>> (define-derived-mode cuda-ts-mode c++-ts-mode "Cuda" ...
>>>> ```
>>>>
>>>> Then I have fontlock, but it seems taken from C++ grammar and
>>>> indentation still doesn't work. It actually creates a 'cpp grammar,
>>>> which I think is not desired in this case.
>>>>
>>>> Indentation doesn't work in this case because:
>>>>
>>>> ```
>>>> (treesit-node-language (treesit-node-at (point)))
>>>> ```
>>>>
>>>> returns 'cuda, but `treesit-simple-indent-rules' has 'cpp key; and
>>>> the `treesit-simple-indent' function has:
>>>>
>>>> ```
>>>> (language (treesit-node-language parent))
>>>> (rules (alist-get language treesit-simple-indent-rules))
>>>> ```
>>>>
>>>> The code in `c-ts-mode--simple-indent-rules' ends with:
>>>>
>>>> (pcase mode
>>>> ('c `((c . ,rules)))
>>>> ('cpp `((cpp . ,rules))))
>>>>
>>>> So it can only create 'cpp or 'c keys and `treesit-node-language' uses
>>>> `treesit-parser-language' (which is correct). So I still need to remap
>>>> things manually.
>>>>
>>>> In font-lock I cannot see in such details because the var
>>>> `treesit-font-lock-settings' is more opaque, but I suppose that there
>>>> may be happening something similar.
>>>>
>>>
>>> Thanks Ergus. I was trying to avoid using the heavy hammer but it seems we have to make it completely transparent. I pushed a change to master. Now when you create a cuda parser using the remapping from cpp, it should completely look and talk like a cpp parser.
>>>
>>> Font-lock should work though. It worked for me when I tested it locally.
>>>
>>> Yuan
>>
>> I have exactly the same error as before.
>>
>> This is the code:
>>
>> ```
>> (define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
>> "Major mode for editing Cuda, powered by tree-sitter.
>>
>> This mode is independent from the classic cuda-mode.el, but inherits
>> most of the properties from c++-ts-mode like `c-ts-mode-indent-style',
>> `c-ts-mode-indent-offset' or `c-ts-mode-enable-doxygen'."
>>
>> (when (treesit-ready-p 'cuda)
>>
>> (setq treesit-language-remap-alist '((cpp . cuda)))
>> (setq-local treesit-primary-parser (treesit-parser-create 'cuda))
>
>I think if you replace ‘cuda with ‘cpp here, everything should work. This parser will be a cuda parser but labeled as cpp parser. That also means if you want to add coda-specific font-lock rules or indentation, you need to use ‘cpp’ as the language key.
>
>>
>> (treesit-major-mode-setup)))
>> ```
>>
>> (treesit-node-language (treesit-node-at (point))) => cuda
>> treesit-simple-indent-rules => nil
>> treesit-font-lock-settings => nil
>>
>> What I am doing wrong?
>>
>> ...
>>
>> Should I derive from c++-ts-mode instead?
>
>You don’t need to, c-ts-base-mode is fine.
>
>>
>> In that case, font-lock works but I don't know if it is with the cuda or
>> cpp parser.
>>
>> However, indentation doesn't work at all for the same explication in the
>> last email.
>>
>> (treesit-node-language (treesit-node-at (point))) returns cuda, but keys
>> in indent-rules is cpp.
>
>Please see this patch. With this patch I can get cuda work for both font-lock and indentation.
>
>Yuan
>
>
>
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 20 Jan 2025 23:30:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 18:30:15 2025
Received: from localhost ([127.0.0.1]:52066 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ta1Di-0000tW-GY
for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 18:30:15 -0500
Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:56521)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1ta1DX-0000mX-IC
for 72388 <at> debbugs.gnu.org; Mon, 20 Jan 2025 18:30:05 -0500
Received: by mail-pj1-x1036.google.com with SMTP id
98e67ed59e1d1-2f78a4ca5deso4142838a91.0
for <72388 <at> debbugs.gnu.org>; Mon, 20 Jan 2025 15:30:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1737415797; x=1738020597; darn=debbugs.gnu.org;
h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
:from:from:to:cc:subject:date:message-id:reply-to;
bh=DjYRQbzzP7ozAgPqpgruaH5fDQzIS1zIke9dmgQZPNw=;
b=PSBz3h/cE4O8hGYwKsvUD8H14iSAKH9ZiCOICpeugpgK67AuNpZ1HLsjPd6XZr4EgP
lqaQWLoLu8SpbsPlfw9wi8/02cmD1aR6DMIOtLPM3VVW4+fH1Tg67uKOvoy3TzWUD94B
VEJmcKS+0yeU4+kt/2DQXXBYHmuGMWy3uiyeACWfI07kuDirrxzKk0qsMKDOIEdsEe0W
iWHoLRvhUgrzrIYl3SEXWETwcOayAKmn3yLYxjzj278TY7OtFS8223wbg3mz+op70WGI
7JqIWL3gxGwSjocDX7cuyWW5QWVQWroD+g0T4kF3k8HWwnXNpITh/zCCfobv+oTBmWNh
qiWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1737415797; x=1738020597;
h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
:from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=DjYRQbzzP7ozAgPqpgruaH5fDQzIS1zIke9dmgQZPNw=;
b=ghsNzvZxhIGDO9ATRIpfp9UKRPDSghSHdKXsnY7dKnG/c+WWhh5V+X+qwAwK15iY31
J8BpP8juhkmuvAaaQoBiZ/yA4Bo7z2ADKkneWLCXFSnnGrPZM7ilZRFQxLFZyWVngbSU
C71lbyK5IN/9iGD2rUYnn2wvoFpuguBdSjp7NQyzsoueFShtuJDTELkB2jBf5rwj1yvH
mPsi1W/42ZR3vskVqLuPvF/dvcQIf7pq/Bp9bqw50YWJl/l6KxttlURWo/S7MQRXOV83
G+qH5Q0Z3DXBhplIYavCssDbnLgaFbs5SRko4e7A6dPvSRTQfDLMFmgYvrhHOEOo1HKt
tRLQ==
X-Gm-Message-State: AOJu0YyjoBItFMTA67bUM9nU3kAc3eh/d1XsHmMicezk8V0LijO20WWu
miEAk3UYIwApC1OhJGGM6083ju67S4y2O1V5bHeeBn2M8UzXQu3c
X-Gm-Gg: ASbGncuHbhuYroWXrvJa+zwEhsuKgtuD7XRcIubeEIKk/e8IxtsWMy/BJ2m5dkEzEL4
p1l7OqBYRQ6DTrRYeGt0MZxdSXlB4t1vPOFjrJaySf8XEfyelo7/Uq3NTAAXyCe8P3sUxH5/I9l
T2CzgJSP3oQyR1brwXrCiS4B4MvgxINSb2WpDrJnW2hRsI1EiK6dPHG2OVTamBghdoaJz0JZnV6
ztfUsb9PGlwy5QUKciEejlT4iS96NT5QkTYZ6VCkNcQ9eVZhhnOUkUQTMJtM6gDYh+u2t6UVcv8
WcVlxiedyD/ZXTklmA==
X-Google-Smtp-Source: AGHT+IGnaWdHusHyhrhahUA0Ljps0u3W2e/PQJKIe2P8BjQVrc0G/TDqD0vQA+ltjeUlgJmL5uq6SQ==
X-Received: by 2002:a17:90b:2dc6:b0:2ee:d63f:d8f with SMTP id
98e67ed59e1d1-2f782c787f3mr21194527a91.13.1737415797183;
Mon, 20 Jan 2025 15:29:57 -0800 (PST)
Received: from smtpclient.apple ([2601:646:8f81:6120:f8d9:1574:4773:81d6])
by smtp.gmail.com with ESMTPSA id
98e67ed59e1d1-2f72c1cc867sm11414963a91.26.2025.01.20.15.29.56
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Mon, 20 Jan 2025 15:29:56 -0800 (PST)
From: Yuan Fu <casouri@HIDDEN>
Message-Id: <664A137C-90A8-4ADD-AE6F-F89E18D7FFEF@HIDDEN>
Content-Type: multipart/mixed;
boundary="Apple-Mail=_1CBCC366-9AE5-4559-8A5C-B08AE17BE4A9"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\))
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
Date: Mon, 20 Jan 2025 15:29:45 -0800
In-Reply-To: <flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54>
To: Ergus <spacibba@HIDDEN>
References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y>
<j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
<1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
<psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
<17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN>
<0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
<6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
<88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN>
<flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54>
X-Mailer: Apple Mail (2.3776.700.51)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--Apple-Mail=_1CBCC366-9AE5-4559-8A5C-B08AE17BE4A9
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
> On Jan 20, 2025, at 9:09=E2=80=AFAM, Ergus <spacibba@HIDDEN> wrote:
>=20
> Hi Yuan:
>=20
> Very thanks for your reply and patches :) I think I am bothering too
> much :p
No no, sorry, I didn=E2=80=99t explain it clear enough.
>=20
> On Sun, Jan 19, 2025 at 10:57:16PM -0800, Yuan Fu wrote:
>>=20
>>=20
>>> On Jan 18, 2025, at 4:42=E2=80=AFAM, Ergus <spacibba@HIDDEN> wrote:
>>>=20
>>> On Fri, Jan 17, 2025 at 05:29:00PM -0800, Yuan Fu wrote:
>>>=20
>>> Hi Yuan:
>>>=20
>>> Very thanks for your answer and quick fix ;)
>>>=20
>>> However when I try this:
>>>=20
>>> ```
>>> (define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
>>> (when (treesit-ready-p 'cuda)
>>> (setq-local treesit-primary-parser (treesit-parser-create 'cuda))
>>> (setq-local treesit-language-remap-alist '((cpp . cuda)))))
>>> ```
>>>=20
>>> `treesit-simple-indent-rules' and `treesit-font-lock-settings' are =
nil.
>>>=20
>>> On the other hand:
>>>=20
>>> If I do instead:
>>>=20
>>> ```
>>> (define-derived-mode cuda-ts-mode c++-ts-mode "Cuda" ...
>>> ```
>>>=20
>>> Then I have fontlock, but it seems taken from C++ grammar and
>>> indentation still doesn't work. It actually creates a 'cpp grammar,
>>> which I think is not desired in this case.
>>>=20
>>> Indentation doesn't work in this case because:
>>>=20
>>> ```
>>> (treesit-node-language (treesit-node-at (point)))
>>> ```
>>>=20
>>> returns 'cuda, but `treesit-simple-indent-rules' has 'cpp key; and
>>> the `treesit-simple-indent' function has:
>>>=20
>>> ```
>>> (language (treesit-node-language parent))
>>> (rules (alist-get language treesit-simple-indent-rules))
>>> ```
>>>=20
>>> The code in `c-ts-mode--simple-indent-rules' ends with:
>>>=20
>>> (pcase mode
>>> ('c `((c . ,rules)))
>>> ('cpp `((cpp . ,rules))))
>>>=20
>>> So it can only create 'cpp or 'c keys and `treesit-node-language' =
uses
>>> `treesit-parser-language' (which is correct). So I still need to =
remap
>>> things manually.
>>>=20
>>> In font-lock I cannot see in such details because the var
>>> `treesit-font-lock-settings' is more opaque, but I suppose that =
there
>>> may be happening something similar.
>>>=20
>>=20
>> Thanks Ergus. I was trying to avoid using the heavy hammer but it =
seems we have to make it completely transparent. I pushed a change to =
master. Now when you create a cuda parser using the remapping from cpp, =
it should completely look and talk like a cpp parser.
>>=20
>> Font-lock should work though. It worked for me when I tested it =
locally.
>>=20
>> Yuan
>=20
> I have exactly the same error as before.
>=20
> This is the code:
>=20
> ```
> (define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
> "Major mode for editing Cuda, powered by tree-sitter.
>=20
> This mode is independent from the classic cuda-mode.el, but inherits
> most of the properties from c++-ts-mode like `c-ts-mode-indent-style',
> `c-ts-mode-indent-offset' or `c-ts-mode-enable-doxygen'."
>=20
> (when (treesit-ready-p 'cuda)
>=20
> (setq treesit-language-remap-alist '((cpp . cuda)))
> (setq-local treesit-primary-parser (treesit-parser-create 'cuda))
I think if you replace =E2=80=98cuda with =E2=80=98cpp here, everything =
should work. This parser will be a cuda parser but labeled as cpp =
parser. That also means if you want to add coda-specific font-lock rules =
or indentation, you need to use =E2=80=98cpp=E2=80=99 as the language =
key.
>=20
> (treesit-major-mode-setup)))
> ```
>=20
> (treesit-node-language (treesit-node-at (point))) =3D> cuda
> treesit-simple-indent-rules =3D> nil
> treesit-font-lock-settings =3D> nil
>=20
> What I am doing wrong?
>=20
> ...
>=20
> Should I derive from c++-ts-mode instead?
You don=E2=80=99t need to, c-ts-base-mode is fine.
>=20
> In that case, font-lock works but I don't know if it is with the cuda =
or
> cpp parser.
>=20
> However, indentation doesn't work at all for the same explication in =
the
> last email.
>=20
> (treesit-node-language (treesit-node-at (point))) returns cuda, but =
keys
> in indent-rules is cpp.
Please see this patch. With this patch I can get cuda work for both =
font-lock and indentation.
Yuan
--Apple-Mail=_1CBCC366-9AE5-4559-8A5C-B08AE17BE4A9
Content-Disposition: attachment;
filename=cuda-ts-mode.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="cuda-ts-mode.patch"
Content-Transfer-Encoding: quoted-printable
=46rom=2092a38254c6e9bb271003cf980db99c2920758f76=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Yuan=20Fu=20<casouri@HIDDEN>=0ADate:=20Mon,=20=
20=20Jan=202025=2015:20:58=20-0800=0ASubject:=20[PATCH]=20Create=20a=20=
cuda=20parser=20that=20looks=20like=20a=20cpp=20parser=0A=0A---=0A=20=
cuda-ts-mode.el=20|=2036=20+++++++++++++++++-------------------=0A=201=20=
file=20changed,=2017=20insertions(+),=2019=20deletions(-)=0A=0Adiff=20=
--git=20a/cuda-ts-mode.el=20b/cuda-ts-mode.el=0Aindex=200f437f6..d8460f9=20=
100644=0A---=20a/cuda-ts-mode.el=0A+++=20b/cuda-ts-mode.el=0A@@=20-46,7=20=
+46,7=20@@=20The=20same=20happens=20when=20calling=20kernels=20<<<=20and=20=
>>>"=0A=20=20=20=20=20=20=20=20=20=20=20=20=20(treesit-node-parent=0A=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(treesit-node-at=20(match-beginning=20=
0))))=0A=20=20=20=20=20=20=20((or=20"kernel_call_syntax"=0A-=09=20=20=20=
"template_argument_list")=0A+=09=20=20=20=20=20=20=20=
"template_argument_list")=0A=20=20=20=20=20=20=20=20(put-text-property=20=
(match-beginning=200)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20(match-end=200)=0A=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'syntax-table=0A@@=20=
-54,22=20+54,15=20@@=20The=20same=20happens=20when=20calling=20kernels=20=
<<<=20and=20>>>"=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(?<=20'(4=20.=20?>))=0A=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(?>=20=
'(5=20.=20?<))))))))=0A=20=0A-;;=20I=20need=20this=20extra=20code=20to=20=
replace=20the=20'cpp=20key=20with=20'cuda=0A-(defun=20=
cuda-ts-mode--simple-indent-rules=20()=0A-=20=20(let=20((cpp-rules=20=
(c-ts-mode--simple-indent-rules=0A-=09=09=20=20=20=20'cpp=20=
c-ts-mode-indent-style)))=0A-=20=20=20=20`((cuda=20.=20,(alist-get=20=
'cpp=20cpp-rules))))=0A-=20=20"Tree-sitter=20indentation=20settings.")=0A=
-=0A=20;;=20Cuda=20grammar=20seems=20not=20to=20support=20"virtual"=20as=20=
a=20node=0A=20;;=20the=20c-ts-mode=20c-ts-mode--test-virtual-named-p=20=
hardcodes=20cpp=20which=0A=20;;=20then=20fails=20to=20compile=20=
treesit-font-lock-rules=20when=20calling=0A=20;;=20=
treesit-validate-font-lock-rules=0A=20(defconst=20cuda-ts-mode--keywords=0A=
=20=20=20(append=20(c-ts-mode--keywords=20'cpp)=0A-=09=20=20=
`("__shared__"=20"__global__"=20"__local__"=20"__constant__"=0A-=09=20=20=
=20=20"__managed__"=20"__grid_constant__"=0A-=09=20=20=20=20"__device__"=20=
"__host__"=20"__forceinline__"=20"__noinline__"=20"virtual"))=0A+=09=20=20=
=20=20=20=20`("__shared__"=20"__global__"=20"__local__"=20"__constant__"=0A=
+=09=20=20=20=20=20=20=20=20"__managed__"=20"__grid_constant__"=0A+=09=20=
=20=20=20=20=20=20=20"__device__"=20"__host__"=20"__forceinline__"=20=
"__noinline__"=20"virtual"))=0A=20=20=20"Tree-sitter=20cuda=20=
keywords.")=0A=20=0A=20;;=20This=20is=20actually=20a=20copy=20of=20=
c-ts-mode--font-lock-settings=0A@@=20-222,8=20+215,6=20@@=20The=20same=20=
happens=20when=20calling=20kernels=20<<<=20and=20>>>"=0A=20=20=20=20=20=20=
=20(:match=20,c-ts-mode--for-each-tail-regexp=20@for-each-tail))))=0A=20=20=
=20"Tree-sitter=20font-lock=20settings.")=0A=20=0A-=0A-=0A=20=
;;;###autoload=0A=20(define-derived-mode=20cuda-ts-mode=20c-ts-base-mode=20=
"Cuda"=0A=20=20=20"Major=20mode=20for=20editing=20Cuda,=20powered=20by=20=
tree-sitter.=0A@@=20-234,15=20+225,22=20@@=20most=20of=20the=20=
properties=20from=20c++-ts-mode=20like=20`c-ts-mode-indent-style',=0A=20=0A=
=20=20=20(when=20(treesit-ready-p=20'cuda)=0A=20=0A-=20=20=20=20=
(setq-local=20treesit-primary-parser=20(treesit-parser-create=20'cuda)=0A=
-=09=09syntax-propertize-function=20#'cuda-ts-mode--syntax-propertize=0A=
-=09=09treesit-simple-indent-rules=20(cuda-ts-mode--simple-indent-rules)=0A=
-=09=09treesit-font-lock-settings=20cuda-ts-mode--font-lock-settings)=0A=
+=20=20=20=20(setq-local=20treesit-language-remap-alist=20'((cpp=20.=20=
cuda)))=0A+=0A+=20=20=20=20(setq-local=0A+=20=20=20=20=20;;=20Create=20a=20=
"cpp"=20parser=20which=20is=20actually=20a=20cuda=20parser.=20It=E2=80=99s=
=0A+=20=20=20=20=20;;=20important=20to=20use=20=E2=80=98cpp=E2=80=99=20=
here,=20so=20that=20the=20parser=20is=20labeled=20as=0A+=20=20=20=20=20=
;;=20a=20cpp=20parser.=0A+=20=20=20=20=20treesit-primary-parser=20=
(treesit-parser-create=20'cpp)=0A+=09=20syntax-propertize-function=20=
#'cuda-ts-mode--syntax-propertize=0A+=09=20treesit-simple-indent-rules=20=
(c-ts-mode--simple-indent-rules=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'cpp=20=
c-ts-mode-indent-style)=0A+=09=20treesit-font-lock-settings=20=
(c-ts-mode--font-lock-settings=20'cpp))=0A=20=0A=20=20=20=20=20=
(treesit-major-mode-setup)=0A=20=0A=20=20=20=20=20(when=20(and=20=
c-ts-mode-enable-doxygen=0A-=09=20=20=20=20=20=20=20(treesit-ready-p=20=
'doxygen=20t))=0A+=09=20=20=20=20=20=20=20=20=20=20=20(treesit-ready-p=20=
'doxygen=20t))=0A=20=20=20=20=20=20=20(setq-local=20=
treesit-font-lock-settings=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20(append=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20treesit-font-lock-settings=0A@@=20-250,7=20+248,7=20@@=20most=20=
of=20the=20properties=20from=20c++-ts-mode=20like=20=
`c-ts-mode-indent-style',=0A=20=20=20=20=20=20=20(setq-local=20=
treesit-range-settings=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(treesit-range-rules=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20:embed=20'doxygen=0A-=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20:host=20'cuda=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20:host=20'cpp=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20:local=20t=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20`(((comment)=20@cap=0A=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(:match=0A--=20=0A2.39.5=20(Apple=20=
Git-151)=0A=0A=
--Apple-Mail=_1CBCC366-9AE5-4559-8A5C-B08AE17BE4A9
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
--Apple-Mail=_1CBCC366-9AE5-4559-8A5C-B08AE17BE4A9--
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 20 Jan 2025 17:09:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 12:09:42 2025
Received: from localhost ([127.0.0.1]:52172 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tZvHR-0005WD-QA
for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 12:09:42 -0500
Received: from sonic303-2.consmr.mail.bf2.yahoo.com ([74.6.131.41]:32784)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1tZvHO-0005Vw-Oe
for 72388 <at> debbugs.gnu.org; Mon, 20 Jan 2025 12:09:40 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
t=1737392971; bh=+w1wJmZs9fPh1vy+T9Fpxi9tImuaMtemcuy62nBffUg=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To;
b=MxhaiyDMYT1f9Y6CFM0mxWT9qIq3mbgZBVYUJgKzto8lPwVVXMSFun1fE1OWlcRiRLC6BA5BukAkACw7rMueAyS/XwPXyyJv8dkEIayjx6KQiQexsrRscsfQ4oZZ+SBXHH11IHrmKurEghIDqkjPquTLw8BMM1cfQEfSLmar4wYIzn9Y0WD69OgKDQE/lKxwS6FwpUPEIvy6k40T3jf6vyiLoluNCDyLUouOEbtlFekn24NC/njPYdB8qNweF3uq6LMg0wmgoS6lIfpKpOsaCxjZaIh+Rzc6qqqr0QnP4h9+qF+qAsxPc1AQqs4zAshr/EgvZvZ3RA6AySiHQz5KQQ==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1737392971; bh=xJshm8nCxawzW+WFP2IM2agNb1ic1lWA3qrCVvJVxcy=;
h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
b=BEqiG1+qqy5JXb6JU6zFRPrKejCyb/eitfZNGeMRY3e+BZ6aoXlSgkpzWXxhx/LwZ27nciIvpJOmuSi83XlaXQ7fsTXsjyTJg/pA6TffRBCp8EIec+afoYBaNIh+tNWm2jaFi7IvdGKz0QAZ/e5KJPbGgKRNAIxgBzeNsjReQOGQMjvOYQ8/aTackU5sQO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nFCrF5ID0aouJvnckz3i8..ClqG_sxmtR.At_7.g1SSF1o4pBFeLI7okPuDaQEIjGfADTrV
bgNPbJao_ChiTr.Md5XCrYDCxNeUazq_y6ZJBCiXVXa8NyvpxAnCs1IUkzc6WR1Khao1Xdd8PmM5
YrO2qOhcUVXJuXOvoZf91Yy5BLIMSsoHXXm7.iw7pkG5fUcnNM1Qj4ekyXySeQVwuK0x3e8NjZf7
7mfsYU3vRAfwXqh_DyG8yvh6qG0doXF6iVqUgSoRbEDTDJp2q9b4aYI3_YfOamNs8m4x37l6O1TX
9BT1UcKOYEG0-
X-Sonic-MF: <spacibba@HIDDEN>
X-Sonic-ID: a929fde8-2663-4efa-9ed7-bfc497763d7c
Received: from sonic.gate.mail.ne1.yahoo.com by
sonic303.consmr.mail.bf2.yahoo.com with HTTP; Mon, 20 Jan 2025 17:09:31 +0000
Received: by hermes--production-ir2-c694d79d9-qdvzb (Yahoo Inc. Hermes SMTP
Server) with ESMTPA ID 2921fe0408bcbd4d0854ca921760c741;
Mon, 20 Jan 2025 17:09:29 +0000 (UTC)
Date: Mon, 20 Jan 2025 18:09:27 +0100
From: Ergus <spacibba@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
Message-ID: <flgfgkxpa6ahkm3it4lsljiwhyx4uiqiddpozlqweh6v7yligp@fgoajcncpn54>
References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y>
<j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
<1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
<psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
<17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN>
<0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
<6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
<88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN>
X-Mailer: WebService/1.1.23187
mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 3320
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hi Yuan:
Very thanks for your reply and patches :) I think I am bothering too
much :p
On Sun, Jan 19, 2025 at 10:57:16PM -0800, Yuan Fu wrote:
>
>
>> On Jan 18, 2025, at 4:42 AM, Ergus <spacibba@HIDDEN> wrote:
>>
>> On Fri, Jan 17, 2025 at 05:29:00PM -0800, Yuan Fu wrote:
>>
>> Hi Yuan:
>>
>> Very thanks for your answer and quick fix ;)
>>
>> However when I try this:
>>
>> ```
>> (define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
>> (when (treesit-ready-p 'cuda)
>> (setq-local treesit-primary-parser (treesit-parser-create 'cuda))
>> (setq-local treesit-language-remap-alist '((cpp . cuda)))))
>> ```
>>
>> `treesit-simple-indent-rules' and `treesit-font-lock-settings' are nil.
>>
>> On the other hand:
>>
>> If I do instead:
>>
>> ```
>> (define-derived-mode cuda-ts-mode c++-ts-mode "Cuda" ...
>> ```
>>
>> Then I have fontlock, but it seems taken from C++ grammar and
>> indentation still doesn't work. It actually creates a 'cpp grammar,
>> which I think is not desired in this case.
>>
>> Indentation doesn't work in this case because:
>>
>> ```
>> (treesit-node-language (treesit-node-at (point)))
>> ```
>>
>> returns 'cuda, but `treesit-simple-indent-rules' has 'cpp key; and
>> the `treesit-simple-indent' function has:
>>
>> ```
>> (language (treesit-node-language parent))
>> (rules (alist-get language treesit-simple-indent-rules))
>> ```
>>
>> The code in `c-ts-mode--simple-indent-rules' ends with:
>>
>> (pcase mode
>> ('c `((c . ,rules)))
>> ('cpp `((cpp . ,rules))))
>>
>> So it can only create 'cpp or 'c keys and `treesit-node-language' uses
>> `treesit-parser-language' (which is correct). So I still need to remap
>> things manually.
>>
>> In font-lock I cannot see in such details because the var
>> `treesit-font-lock-settings' is more opaque, but I suppose that there
>> may be happening something similar.
>>
>
>Thanks Ergus. I was trying to avoid using the heavy hammer but it seems we have to make it completely transparent. I pushed a change to master. Now when you create a cuda parser using the remapping from cpp, it should completely look and talk like a cpp parser.
>
>Font-lock should work though. It worked for me when I tested it locally.
>
>Yuan
I have exactly the same error as before.
This is the code:
```
(define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
"Major mode for editing Cuda, powered by tree-sitter.
This mode is independent from the classic cuda-mode.el, but inherits
most of the properties from c++-ts-mode like `c-ts-mode-indent-style',
`c-ts-mode-indent-offset' or `c-ts-mode-enable-doxygen'."
(when (treesit-ready-p 'cuda)
(setq treesit-language-remap-alist '((cpp . cuda)))
(setq-local treesit-primary-parser (treesit-parser-create 'cuda))
(treesit-major-mode-setup)))
```
(treesit-node-language (treesit-node-at (point))) => cuda
treesit-simple-indent-rules => nil
treesit-font-lock-settings => nil
What I am doing wrong?
...
Should I derive from c++-ts-mode instead?
In that case, font-lock works but I don't know if it is with the cuda or
cpp parser.
However, indentation doesn't work at all for the same explication in the
last email.
(treesit-node-language (treesit-node-at (point))) returns cuda, but keys
in indent-rules is cpp.
Once again, sorry for bothering so much,
Best,
Ergus
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 20 Jan 2025 06:57:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 01:57:37 2025
Received: from localhost ([127.0.0.1]:48769 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tZlj7-00070r-74
for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 01:57:37 -0500
Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:52289)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1tZlj4-00070b-Gw
for 72388 <at> debbugs.gnu.org; Mon, 20 Jan 2025 01:57:35 -0500
Received: by mail-pl1-x631.google.com with SMTP id
d9443c01a7336-2165cb60719so69322875ad.0
for <72388 <at> debbugs.gnu.org>; Sun, 19 Jan 2025 22:57:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1737356248; x=1737961048; darn=debbugs.gnu.org;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=VI0DQ5ceyw0VxE88pwgZC9eZect+OBGbWWIFpdM/Ziw=;
b=Wed/btlpEAyxEHsjidrZEZjFnbE29kdVZlljipnDLhWUFLxeKatLBGTn9T0RGrXFA+
PeLe9rADrxDUfMiN9BNO5SXWO3j7v3IOz8BtsArOp1sqizv0w9sxAvv93fFL/aWIpKea
pXqq6a2oJtca749bke1Kb/3yKuuSRFkwyawX1nKSgLmvDnJ/dPTYGK4gh8osQkbTd95I
vE7u3CGoqyy8SrPgOOHq9k9QDR+4utj+Gyc5kIShG09L2wj4nJ2ySxDyyePRF5pSOtpI
7ICRnLmnUbfszAFjbBPElVxoKq1uRojdFFW15FlszVct9ql3EUDpuQVuu7sRl0WA3tCI
tMxw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1737356248; x=1737961048;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=VI0DQ5ceyw0VxE88pwgZC9eZect+OBGbWWIFpdM/Ziw=;
b=aT0xGm8r/woYWZ1SkFTsOerAW4bQAU76w8WYp06rrsONW/FjyzHNoSBFAGEkH/KhA4
uLnI6Os+vOVN4wpxv2rxksOeR3a5kYnU5wJsw/8/rhmwf9xpSGhCwEyuz++D0y1H22fv
jdwjhMDEtBa/FPKAN331+CUntzkKzNeJD4ghpokgQSeHeksWieTkJgr6DiQrM8YIhZ6E
aVvKbNiIuyWlSAsElm1adX8f3e0tSy0Vs1tS6VmstQnQQA2t6OcDZwqxS7x+3nHiElkW
nk9SK/kLnZGBH+GnCyr5hrU0PZXhyDXYHEVo8zh3HjF6S0E31qaCooWC/gf8EvDIqy9+
vAog==
X-Gm-Message-State: AOJu0Yx6SaTtG79wsDtvTKVOBW5rjfHdGoBaQUQQ6Cpb6Dhl6F442ynJ
0xTu4e/HF4oxZWmYuu8wdpa40M0LahcG1zwdBJYqXvER6SymTFsO
X-Gm-Gg: ASbGnct26dsPAUEXrLgz0vx+r7Nl1alWDIbnS23njYbxnVomBIKFFaz3sXIfxCVMw0Z
5Zaj8H5ZOWrHAyJerIPNCFZm7c0Ttc6MoUWWMROFGBv7/JBfyWyZ35HoNPh/yrsVbJp1wPnK7bG
r6ujS0KOUQb7faTXjZehf0OXkbAHHn6miFd8uxHoMlF4vmGnu8x3WQkgZ0SD/lx35N3mOe8AkUl
1EZqsJ6jEMLgJHt2YwrAhfHNYk/E7Lhd5ON15HLGSg85XM2VUyGiYlw5ICrDQuJqOq6gU6enb1s
vSzKQZ6DcuPHkWSYbQ==
X-Google-Smtp-Source: AGHT+IGI//7mW3YFopS9DHoKNPoxteq6kKfW40XqHt4UOLUJ7NZGcKM+0bsAN2u8XOMVgSOyBVL8xg==
X-Received: by 2002:a05:6a20:7faa:b0:1e0:d89e:f5bc with SMTP id
adf61e73a8af0-1eb2149441fmr17121276637.11.1737356248187;
Sun, 19 Jan 2025 22:57:28 -0800 (PST)
Received: from smtpclient.apple ([2601:646:8f81:6120:f8d9:1574:4773:81d6])
by smtp.gmail.com with ESMTPSA id
d2e1a72fcca58-72dab9c8b5fsm6467247b3a.90.2025.01.19.22.57.27
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Sun, 19 Jan 2025 22:57:27 -0800 (PST)
Content-Type: text/plain;
charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\))
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
Date: Sun, 19 Jan 2025 22:57:16 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <88EB5ACE-1F9F-4769-9DF0-B480EC6DDE2C@HIDDEN>
References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y>
<j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
<1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
<psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
<17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN>
<0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
<6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
To: Ergus <spacibba@HIDDEN>
X-Mailer: Apple Mail (2.3776.700.51)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
> On Jan 18, 2025, at 4:42=E2=80=AFAM, Ergus <spacibba@HIDDEN> wrote:
>=20
> On Fri, Jan 17, 2025 at 05:29:00PM -0800, Yuan Fu wrote:
>>=20
>>=20
>>> On Jan 17, 2025, at 5:04=E2=80=AFPM, Yuan Fu <casouri@HIDDEN> =
wrote:
>>>=20
>>>=20
>>>=20
>>>> On Jan 16, 2025, at 11:35=E2=80=AFAM, Ergus <spacibba@HIDDEN> =
wrote:
>>>>=20
>>>> Hi Yuan:
>>>>=20
>>>> It has been a long time since this emails.. But today finally I =
made my
>>>> serious attempt to make a `cuda-ts-mode`.
>>>>=20
>>>> While the treesit-language-remap-alist helped to reuse an important =
part
>>>> of the code, there were a few issues I needed to manage manually =
and
>>>> maybe they could be improved somehow:
>>>>=20
>>>> 1. The indentation rules still uses the 'cpp prefix, so I had to
>>>> manually tune the code:
>>>>=20
>>>> ```
>>>> (defun cuda-ts-mode--simple-indent-rules ()
>>>> (let ((cpp-rules (c-ts-mode--simple-indent-rules
>>>> 'cpp c-ts-mode-indent-style)))
>>>> `((cuda . ,(alist-get 'cpp cpp-rules)))))
>>>>=20
>>>>=20
>>>> (setq-local treesit-simple-indent-rules
>>>> (cuda-ts-mode--simple-indent-rules))
>>>> ```
>>>>=20
>>>> In order to manage it properly
>>>>=20
>>>> 2. I see that font-lock is working, but the fontlock rules check is
>>>> using the cpp parser.
>>>>=20
>>>> That's because the c-ts-mode--font-lock-settings still receives cpp =
as input.
>>>> I am trying to find a way to get it from c++ and then change the
>>>> :language cpp
>>>> with
>>>> :language cuda
>>>> because if I call
>>>> (c-ts-mode--font-lock-settings 'cuda) I obviously get an error.
>>>>=20
>>>> Is there some way to go around these in a cleaner way?
>>>=20
>>> Thanks Ergus, once you map a language to another, it should be =
transparent, and you shouldn=E2=80=99t need to change cpp to cuda. =
It=E2=80=99s most likely a bug somewhere. I=E2=80=99ll fix it.
>>>=20
>>> Yuan
>>=20
>> Ok, now using c-ts-mode=E2=80=99s font-lock and indentation rules =
verbatim should work. BTW, you should have
>>=20
>> (setq-local treesit-language-remap-alist '((cpp . cuda)))
>>=20
>> in cuda-ts-mode=E2=80=99s body.
>>=20
>> Yuan
>>=20
>=20
> Hi Yuan:
>=20
> Very thanks for your answer and quick fix ;)
>=20
> However when I try this:
>=20
> ```
> (define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
> (when (treesit-ready-p 'cuda)
> (setq-local treesit-primary-parser (treesit-parser-create 'cuda))
> (setq-local treesit-language-remap-alist '((cpp . cuda)))))
> ```
>=20
> `treesit-simple-indent-rules' and `treesit-font-lock-settings' are =
nil.
>=20
> On the other hand:
>=20
> If I do instead:
>=20
> ```
> (define-derived-mode cuda-ts-mode c++-ts-mode "Cuda" ...
> ```
>=20
> Then I have fontlock, but it seems taken from C++ grammar and
> indentation still doesn't work. It actually creates a 'cpp grammar,
> which I think is not desired in this case.
>=20
> Indentation doesn't work in this case because:
>=20
> ```
> (treesit-node-language (treesit-node-at (point)))
> ```
>=20
> returns 'cuda, but `treesit-simple-indent-rules' has 'cpp key; and
> the `treesit-simple-indent' function has:
>=20
> ```
> (language (treesit-node-language parent))
> (rules (alist-get language treesit-simple-indent-rules))
> ```
>=20
> The code in `c-ts-mode--simple-indent-rules' ends with:
>=20
> (pcase mode
> ('c `((c . ,rules)))
> ('cpp `((cpp . ,rules))))
>=20
> So it can only create 'cpp or 'c keys and `treesit-node-language' uses
> `treesit-parser-language' (which is correct). So I still need to remap
> things manually.
>=20
> In font-lock I cannot see in such details because the var
> `treesit-font-lock-settings' is more opaque, but I suppose that there
> may be happening something similar.
>=20
Thanks Ergus. I was trying to avoid using the heavy hammer but it seems =
we have to make it completely transparent. I pushed a change to master. =
Now when you create a cuda parser using the remapping from cpp, it =
should completely look and talk like a cpp parser.
Font-lock should work though. It worked for me when I tested it locally.
Yuan=
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 18 Jan 2025 12:43:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 18 07:43:02 2025
Received: from localhost ([127.0.0.1]:40672 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tZ8AH-00066b-Il
for submit <at> debbugs.gnu.org; Sat, 18 Jan 2025 07:43:01 -0500
Received: from sonic311-13.consmr.mail.bf2.yahoo.com ([74.6.131.123]:33398)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1tZ8AF-00066H-0G
for 72388 <at> debbugs.gnu.org; Sat, 18 Jan 2025 07:43:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
t=1737204171; bh=IynyBVLVoqIhextMCmMPs5poVSDpA/j7XFleQj2erFM=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To;
b=Pj7Hs3ttSb5judw75CXxNywK4YMKZ8ns1aYfngWfnP4VJAePR1Dhfk6gRzVgxSjITIw+yd15tlev3DEhv8+3qHEzIXEYFHWM+rSQGR4SN37H0t6JoNKExNU2eQ661lHSpPCF5Og7WS/qfFFmJuY61y3YX1d9+zZNrpOUkUUxP8veeUezmHYoSvcU15shpmNpesWObqkqZO83jWHk0TkgH8wTNxwDCaYhP4HQWt92vqvEk3UfCWk8EYuwKfnrEyB7/Sb+mDueiT4NYr9PDD6mWsdOSs55Tt1YllEiIDpvS/VU3DOk/b5ntGxmIIhQKu7WuOyNCyqMVtF4HGwKPjqb3w==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1737204171; bh=kTxbeTrFZN3gFvInqOkrMqlqeftEOTZ0n6TjSLy5lsz=;
h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
b=EjaBl1ZeZ/ifkUBlY3R+Nutn+2too3gA3LjzJoXkO/uGkM0B7MD3I3iCauH25QpVCKjbObg4cVMPj4OgdCmfASYTHwxsn6zZJsP9WEUdVaiD45MDb+6EVri00UwidddUn+LXdizawNXOOh3FlCl+Vf4kCMuxUR5pqwP3Z4Jo95If3y4EaBv5huxtVk24Z5ZItMqyAPkoPQN2wTN8NZuOliC+V5Y+O5kI4Fo82ul8oGimIGYJUDoEnlsD+LaJbT5OKzHl6ebXKh6YvSmpgxBCwcY+GFsrqeem3N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GXua_jT29BdD4ZPOHFvVQtr6ARJyfiso2kaUDVA7y0LStp
b9MrMddYd4UrNFEpWJ7wMgUYnLDjETN3R7UN86JH9diYa91NYFVOwCEUh3BXF04.OFF2KPCN8PaJ
WSsU768oGFdo12hHMND8sPuWgu_QfK5TcQ.wP2HIUay.mmxJxqWH_YXw2W25Qvgl98YWYDiU9BXy
2YEPy2v0-
X-Sonic-MF: <spacibba@HIDDEN>
X-Sonic-ID: 4ca086da-6d49-4e37-93bd-aea21e6f4124
Received: from sonic.gate.mail.ne1.yahoo.com by
sonic311.consmr.mail.bf2.yahoo.com with HTTP; Sat, 18 Jan 2025 12:42:51 +0000
Received: by hermes--production-ir2-c694d79d9-fn2jw (Yahoo Inc. Hermes SMTP
Server) with ESMTPA ID b1aa9ef64f37f84f742eea5670451e1f;
Sat, 18 Jan 2025 12:42:49 +0000 (UTC)
Date: Sat, 18 Jan 2025 13:42:47 +0100
From: Ergus <spacibba@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
Message-ID: <6tbbklf36szb3spol44ciuaf56qndl5srxp6ilm5lp5rvmje6l@jzqa5xlfapyb>
References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y>
<j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
<1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
<psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
<17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN>
<0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN>
X-Mailer: WebService/1.1.23187
mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 3290
X-Spam-Score: -1.8 (-)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.8 (--)
On Fri, Jan 17, 2025 at 05:29:00PM -0800, Yuan Fu wrote:
>
>
>> On Jan 17, 2025, at 5:04 PM, Yuan Fu <casouri@HIDDEN> wrote:
>>
>>
>>
>>> On Jan 16, 2025, at 11:35 AM, Ergus <spacibba@HIDDEN> wrote:
>>>
>>> Hi Yuan:
>>>
>>> It has been a long time since this emails.. But today finally I made my
>>> serious attempt to make a `cuda-ts-mode`.
>>>
>>> While the treesit-language-remap-alist helped to reuse an important part
>>> of the code, there were a few issues I needed to manage manually and
>>> maybe they could be improved somehow:
>>>
>>> 1. The indentation rules still uses the 'cpp prefix, so I had to
>>> manually tune the code:
>>>
>>> ```
>>> (defun cuda-ts-mode--simple-indent-rules ()
>>> (let ((cpp-rules (c-ts-mode--simple-indent-rules
>>> 'cpp c-ts-mode-indent-style)))
>>> `((cuda . ,(alist-get 'cpp cpp-rules)))))
>>>
>>>
>>> (setq-local treesit-simple-indent-rules
>>> (cuda-ts-mode--simple-indent-rules))
>>> ```
>>>
>>> In order to manage it properly
>>>
>>> 2. I see that font-lock is working, but the fontlock rules check is
>>> using the cpp parser.
>>>
>>> That's because the c-ts-mode--font-lock-settings still receives cpp as input.
>>> I am trying to find a way to get it from c++ and then change the
>>> :language cpp
>>> with
>>> :language cuda
>>> because if I call
>>> (c-ts-mode--font-lock-settings 'cuda) I obviously get an error.
>>>
>>> Is there some way to go around these in a cleaner way?
>>
>> Thanks Ergus, once you map a language to another, it should be transparent, and you shouldn’t need to change cpp to cuda. It’s most likely a bug somewhere. I’ll fix it.
>>
>> Yuan
>
>Ok, now using c-ts-mode’s font-lock and indentation rules verbatim should work. BTW, you should have
>
>(setq-local treesit-language-remap-alist '((cpp . cuda)))
>
>in cuda-ts-mode’s body.
>
>Yuan
>
Hi Yuan:
Very thanks for your answer and quick fix ;)
However when I try this:
```
(define-derived-mode cuda-ts-mode c-ts-base-mode "Cuda"
(when (treesit-ready-p 'cuda)
(setq-local treesit-primary-parser (treesit-parser-create 'cuda))
(setq-local treesit-language-remap-alist '((cpp . cuda)))))
```
`treesit-simple-indent-rules' and `treesit-font-lock-settings' are nil.
On the other hand:
If I do instead:
```
(define-derived-mode cuda-ts-mode c++-ts-mode "Cuda" ...
```
Then I have fontlock, but it seems taken from C++ grammar and
indentation still doesn't work. It actually creates a 'cpp grammar,
which I think is not desired in this case.
Indentation doesn't work in this case because:
```
(treesit-node-language (treesit-node-at (point)))
```
returns 'cuda, but `treesit-simple-indent-rules' has 'cpp key; and
the `treesit-simple-indent' function has:
```
(language (treesit-node-language parent))
(rules (alist-get language treesit-simple-indent-rules))
```
The code in `c-ts-mode--simple-indent-rules' ends with:
(pcase mode
('c `((c . ,rules)))
('cpp `((cpp . ,rules))))
So it can only create 'cpp or 'c keys and `treesit-node-language' uses
`treesit-parser-language' (which is correct). So I still need to remap
things manually.
In font-lock I cannot see in such details because the var
`treesit-font-lock-settings' is more opaque, but I suppose that there
may be happening something similar.
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.Received: (at 72388) by debbugs.gnu.org; 18 Jan 2025 01:29:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 17 20:29:20 2025 Received: from localhost ([127.0.0.1]:39425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tYxeK-0003VM-A5 for submit <at> debbugs.gnu.org; Fri, 17 Jan 2025 20:29:20 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:53660) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1tYxeI-0003V9-3j for 72388 <at> debbugs.gnu.org; Fri, 17 Jan 2025 20:29:18 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-21619108a6bso48321085ad.3 for <72388 <at> debbugs.gnu.org>; Fri, 17 Jan 2025 17:29:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737163752; x=1737768552; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mQbtT4RCwUqvbkqYDyPKSE0IdmMVvqycv8UdeBWkEEU=; b=kiVsVQIKX85dU+Mih+sc3JDbtNSqIQaBoUFSmJ27zzBsiy2RuCFrffWJs2cvSwSl5O j6YcQxrJ7t7Ce6e1ziQYm8GnsrqeK82cCIOIgjYlByS4cQdgMvHimOjc4wUJVFm8kfNM /UlBINU+Gy61N2faxgBSgPpmAvGQzOK9KOVVte3UPswe5ZhOWO3boc12Uw0AfVgGXTX3 4duJ0+ZALhBO+QOotrb7KMY768scNXDI8nO3STJmGiYLvV2UlM/wRHw2MzO7jrjysvYn hd8mDRr0RerWVsnNfk6DJ5WysyhJ2/UEv4zQCZucm1KeO2TheUiCOraRq6vFD+hmdyfN o2Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737163752; x=1737768552; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mQbtT4RCwUqvbkqYDyPKSE0IdmMVvqycv8UdeBWkEEU=; b=mA94hBo2V47PN1dCADVkMyiMb0+7vLSOPZnHN9NhV5gBiBaHAcyQZsc+2dq7bl+ArC W3GSOoddWpeH/tWVw+zEBkHg0YCYth3Jlvh2r4FkjuYJO70JgfHvYWsf26obiRuciyHC Q7dmmgl/ShkKlNxfjCwjXD2XgDdJNc1DN05XG5lqk9WLjYSaCdInVHHy4o4clAfuLRv8 6wS1Vxkr0LKLLzV/wJhJ5QZZUOEIYEfbvzhitDhQp4+oBb/qybHb6i6Li0K0mlf0d0NZ 53bDwHXcPVag/DzwtvZAHCDJVFoid65G3M9tixni8G3Mmq2Axc1O69cjOvnWMimaC64F TpZw== X-Gm-Message-State: AOJu0Yw85BfVeAd0mf3uhWYRc0aUtjS5HW7jg89HjM6gKzUtSOjOxiJm 3iCoJ0fA78qcdU4QoT7/nd1Hwyk2kE7CKZJs4kqmorO0kD1dFzSuQdsIxw== X-Gm-Gg: ASbGncuSKp43dZY39BSLQwV33eJA2T9D3qAedmEibN0Lew18svJT4/1aWcCeLclMxgp KRayeyTdfihXJ5o6XzF0W166uV3ovcD25JKF+qEXkroXR6KSuUYMUFK8BWqP8nT6JnVCDIkVGvh eU+v/Dx4UuzgE6sAjy5h3jWQQhuUcCxXV9hWN70mT6yXoRHvT9FvstS89UEpGEQYJ1Lb+U/3cs6 DG/DMfwjqlZHYvbuAsmef6oSv/+NJvU9kthVfaBrT2v6nrcPJAdB0omAXPPrNxw7YNbNVbtigm/ 7qfpzozkow9y/9Xe X-Google-Smtp-Source: AGHT+IGJ0U+eqQf1XRjkkC3hLBHDjlma8jXiyLeMMf9mayx2nfcMZl+cBh/Kej3Q0H6kDSekhS4OkQ== X-Received: by 2002:a17:902:ce8a:b0:216:6855:15f with SMTP id d9443c01a7336-21c3562198emr64749265ad.51.1737163751923; Fri, 17 Jan 2025 17:29:11 -0800 (PST) Received: from smtpclient.apple ([2601:646:8f81:6120:68f4:70e0:4ac6:498]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2cea05a4sm22299865ad.17.2025.01.17.17.29.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jan 2025 17:29:11 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN> Date: Fri, 17 Jan 2025 17:29:00 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <0EB1458E-25A2-4DC8-BD9A-5F02B0617E68@HIDDEN> References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y> <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y> <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN> <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq> <17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN> To: Ergus <spacibba@HIDDEN> X-Mailer: Apple Mail (2.3776.700.51) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72388 Cc: 72388 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > On Jan 17, 2025, at 5:04=E2=80=AFPM, Yuan Fu <casouri@HIDDEN> = wrote: >=20 >=20 >=20 >> On Jan 16, 2025, at 11:35=E2=80=AFAM, Ergus <spacibba@HIDDEN> wrote: >>=20 >> Hi Yuan: >>=20 >> It has been a long time since this emails.. But today finally I made = my >> serious attempt to make a `cuda-ts-mode`. >>=20 >> While the treesit-language-remap-alist helped to reuse an important = part >> of the code, there were a few issues I needed to manage manually and >> maybe they could be improved somehow: >>=20 >> 1. The indentation rules still uses the 'cpp prefix, so I had to >> manually tune the code: >>=20 >> ``` >> (defun cuda-ts-mode--simple-indent-rules () >> (let ((cpp-rules (c-ts-mode--simple-indent-rules >> 'cpp c-ts-mode-indent-style))) >> `((cuda . ,(alist-get 'cpp cpp-rules))))) >>=20 >>=20 >> (setq-local treesit-simple-indent-rules >> (cuda-ts-mode--simple-indent-rules)) >> ``` >>=20 >> In order to manage it properly >>=20 >> 2. I see that font-lock is working, but the fontlock rules check is >> using the cpp parser. >>=20 >> That's because the c-ts-mode--font-lock-settings still receives cpp = as input. >> I am trying to find a way to get it from c++ and then change the >> :language cpp >> with >> :language cuda >> because if I call >> (c-ts-mode--font-lock-settings 'cuda) I obviously get an error. >>=20 >> Is there some way to go around these in a cleaner way? >=20 > Thanks Ergus, once you map a language to another, it should be = transparent, and you shouldn=E2=80=99t need to change cpp to cuda. = It=E2=80=99s most likely a bug somewhere. I=E2=80=99ll fix it. >=20 > Yuan Ok, now using c-ts-mode=E2=80=99s font-lock and indentation rules = verbatim should work. BTW, you should have (setq-local treesit-language-remap-alist '((cpp . cuda))) in cuda-ts-mode=E2=80=99s body. Yuan
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.Received: (at 72388) by debbugs.gnu.org; 18 Jan 2025 01:04:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 17 20:04:45 2025 Received: from localhost ([127.0.0.1]:39403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tYxGX-0002Gd-Es for submit <at> debbugs.gnu.org; Fri, 17 Jan 2025 20:04:45 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:53559) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1tYxGU-0002GO-8g for 72388 <at> debbugs.gnu.org; Fri, 17 Jan 2025 20:04:43 -0500 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-21619108a6bso48170495ad.3 for <72388 <at> debbugs.gnu.org>; Fri, 17 Jan 2025 17:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737162276; x=1737767076; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pdm5diEcQ+5IYngLQ7JNdbsqj80RqHEX886A4ycnjRw=; b=Xfg6xNgPoCq7toWPEu4lGwwIuZeb4pLk0ebvGS8sQTc1ozRB+9lFgNbdeJekKBZr/x VFtvhF2kCbNOIl4AMRIrrt3yeMhfxyafPRMvZozaaQq/w7pgqiYEMDfWJJMIA+S3gLF3 Wcb7NpP9LOMTMasXQfaRCJ+wasbg/2C+0gLar1oHii+Ruc49scFWfzNp9nizGUf7rB3f x9fA5wRswfEm5cKtnznlEg7GI56fUXbUeNDBm9v5k7uUYnu7KuoP4OJ9+MctF5yWE8Te MFOhfhDZ2TqBNY1AW6krC2HKlezXZmv89+eElIidCn7uokLZEPWU3mfOZ1M+Sy8uCzS1 2sHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737162276; x=1737767076; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pdm5diEcQ+5IYngLQ7JNdbsqj80RqHEX886A4ycnjRw=; b=X3iBg/4LrK2WqzS/vimwx5fGgnBV/mziAZYrcqkD1ca/ldFxdo4kb4glIzJlgZG4qf Yl1MDvQJtGOTkvxHNtNc+SkCNzyQvybwMz0ouVaALhG0yK5xrBG+vplpLONbEpF6GgIk /B9jKZKVXu7Uq95ivKw/S4/+VcdyU+jbs5DAdirkKLJDjWtOC7WLpmC+99Jl04tMTvd6 Y1AR7K3IzblaT4XRaCiMcJPnJriF+1x4Axq/bzLZ5EJ9iZf/M7qoU5tOmHyy+WZVAhrl krr8mDXYvS2mXh09Rio/+gwlf3Oi3r5/kORfgSPhss48EWrMVR6qzb5u2KfbdJ52A7IO 87Bw== X-Gm-Message-State: AOJu0Ywri1BsnvHEZSOMUKMkJt+jdIqh6lwWiOY1otZShS1cQC2Tpq6v wE/c/YTaosTQzSMExj7LkInmBJn6FW82Iryy0wR1Xqx4hmpKKB/m X-Gm-Gg: ASbGncvl4+QMs/ok1wNYL99rAqlcx0DiLN0XGpEclNKeklMMgHqpbgwMusuOlsRmBn4 8Yo3f3eXYd4BbsuAEtFNG/as99GVUNAB9rL1Z5PqRFIHCkZk56eQvRLlly2zyepI325/qZeFXWG TIDahbtq736pJEHXnKyP8E0xf2fokX1Z+AlPzfqIYjLKIk1ESW6Ev6INXPqMhPyFQv64v7QOTUh VRF3XIzHplgPBCIms5SdcszFg1PrRJjzJcI0inY+xCnh10b5Nt4f9LVB5GYfWSaqcx2uvz9Yvt2 JQ6/48ZZTirPrYvg5w== X-Google-Smtp-Source: AGHT+IEHgoTAzt1uMMFWiMJnEPK71YTZqRiRjqZM38OquqibRojMXM9X8c2+FiFSLxeySotEZOuq+w== X-Received: by 2002:a17:902:e745:b0:215:5a53:edee with SMTP id d9443c01a7336-21c352d704amr65562835ad.9.1737162275726; Fri, 17 Jan 2025 17:04:35 -0800 (PST) Received: from smtpclient.apple ([2601:646:8f81:6120:290c:bb92:38fe:ad4d]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2d3e8628sm21776675ad.191.2025.01.17.17.04.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jan 2025 17:04:35 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq> Date: Fri, 17 Jan 2025 17:04:23 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <17F8139D-9A6C-45DB-BD0C-3D518F45138E@HIDDEN> References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y> <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y> <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN> <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq> To: Ergus <spacibba@HIDDEN> X-Mailer: Apple Mail (2.3776.700.51) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72388 Cc: 72388 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > On Jan 16, 2025, at 11:35=E2=80=AFAM, Ergus <spacibba@HIDDEN> wrote: >=20 > Hi Yuan: >=20 > It has been a long time since this emails.. But today finally I made = my > serious attempt to make a `cuda-ts-mode`. >=20 > While the treesit-language-remap-alist helped to reuse an important = part > of the code, there were a few issues I needed to manage manually and > maybe they could be improved somehow: >=20 > 1. The indentation rules still uses the 'cpp prefix, so I had to > manually tune the code: >=20 > ``` > (defun cuda-ts-mode--simple-indent-rules () > (let ((cpp-rules (c-ts-mode--simple-indent-rules > 'cpp c-ts-mode-indent-style))) > `((cuda . ,(alist-get 'cpp cpp-rules))))) >=20 >=20 > (setq-local treesit-simple-indent-rules > (cuda-ts-mode--simple-indent-rules)) > ``` >=20 > In order to manage it properly >=20 > 2. I see that font-lock is working, but the fontlock rules check is > using the cpp parser. >=20 > That's because the c-ts-mode--font-lock-settings still receives cpp as = input. > I am trying to find a way to get it from c++ and then change the > :language cpp > with > :language cuda > because if I call > (c-ts-mode--font-lock-settings 'cuda) I obviously get an error. >=20 > Is there some way to go around these in a cleaner way? Thanks Ergus, once you map a language to another, it should be = transparent, and you shouldn=E2=80=99t need to change cpp to cuda. = It=E2=80=99s most likely a bug somewhere. I=E2=80=99ll fix it. Yuan=
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.Received: (at 72388) by debbugs.gnu.org; 17 Jan 2025 02:22:00 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 16 21:22:00 2025 Received: from localhost ([127.0.0.1]:35382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tYbzj-0002ZK-D7 for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 21:21:59 -0500 Received: from sonic313-15.consmr.mail.bf2.yahoo.com ([74.6.133.125]:33590) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1tYbzf-0002Z1-8W for 72388 <at> debbugs.gnu.org; Thu, 16 Jan 2025 21:21:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1737080507; bh=aBu/yoaIcMZm3l6NBpfC6q8aiocbWlm7NS3+tP8KtKA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=k2FowqZvuYWmhQ2QopL/zWK3X0BbZliMIQ63ILDYqFwXYqomE71GXGc2icbR9Nm3Vh6GufiMkP0eJ6CFpS1/6y+fzzzfVv8JNR9Oh+Jk8yLBSconcR+9ViU2cX2MrIOoFIbaacQKsIe7503E6V2s4AJwj9yvyvPkULIVuMwOLingunnW3XQYFjXNKxGDvZajUXrOpsXG58jJHpkTWfFVR1fKvUGqauwaiCxz8UVkTDXXzdpj6sEmUNJ2HiR84gVd0mK69v9dM3uGIZ658iHCkF1nIHozS9tjJfFUSEu6T0CoHyv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x6hDaVLzA8dt1gA1gRM18Bxdqh_CxyCkF_scD.FFuKLC93AsDoUUDFOjgzICekFcGhJvz I.gCZ9Egdlez97ELvILaKwnt4pznrtjVMDmTt8bR7D4A2kne8y.N2OyGs.U1tMtJ6nflElaebPEP YurZu6UW3aDNk6BnIaabvRdRFXRQxdceyqR1cteVz7eAYEQ1PWCkaj1XPQiccCuA9V6TebDHSGJM Dp8lYKMUSf8bzB9H39h7Uh7Zd6NY7Lk4f4P6Le9ciiyWjOjhTI1.Xty6GuqNB.JtSpwPUCGrnPTw u.ikcvKMw3DG8rJMTvVTRPzNL8dDzQ_IVKN81h9JvQ395ES3Mge5U4vIUqfblfZyOwS1sTYKD9KC fNLjX8rf4bgoNNZLBGnMDxw7LlIywPY_ZcfdJNDLdjnopL_BDjDKh48W.mK2F4.nHE3geyV.OPmw nPyoqQDssSCambS61tA6yLpZSBaaxevJfXOU4vacFI__Sv7mHZ5ViWTB4.rgkD7trAnvX8D8CVh6 VCJyASNL8LwSjbjPKz53LSqAU0f4kj.bnFcuj4OQeJEPp9dULOo.NcJYXQCvDPlnXxjOtynJgFSP a5ggdDVOOnBDWc3fqiEGH1PuSwH2KxwJ93IIj4kN8_la9G4L2ia7ZG2LQQgAC.6tHODUxEACWAbm dBahjBbp7 X-Sonic-MF: <spacibba@HIDDEN> X-Sonic-ID: f4702bb6-4e07-436b-ade4-6d56a073f58a Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Fri, 17 Jan 2025 02:21:47 +0000 Received: by hermes--production-ir2-c694d79d9-fn2jw (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 5e1f85b8280226c45c5a5531408aea9c; Fri, 17 Jan 2025 02:21:46 +0000 (UTC) Date: Fri, 17 Jan 2025 03:21:44 +0100 From: Ergus <spacibba@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules Message-ID: <uilzn6mi656hvmhg6o3ztgmn6q45nisbeklr2sficckpnuyjfo@rvrsqfv6kz2c> References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y> <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y> <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN> <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq> X-Mailer: WebService/1.1.23187 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Content-Length: 3481 X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 72388 Cc: 72388 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.8 (--) At the moment I have a fully functional version on github: https://github.com/Ergus/cuda-ts-mode I don't really like it because the font-lock rules are a copy-paste from c-ts-mode--font-lock-settings, but that function makes so many checks like (eq mode 'cpp) that I cannot avoid. Also the c-ts-mode--test-virtual-named-p hardcodes 'cpp internally. Apart from that everything is more or less working I think. But strong modification suggestions are very welcome ;) Best, Ergus On Thu, Jan 16, 2025 at 08:35:43PM +0100, Ergus wrote: >Hi Yuan: > >It has been a long time since this emails.. But today finally I made my >serious attempt to make a `cuda-ts-mode`. > >While the treesit-language-remap-alist helped to reuse an important part >of the code, there were a few issues I needed to manage manually and >maybe they could be improved somehow: > >1. The indentation rules still uses the 'cpp prefix, so I had to >manually tune the code: > >``` >(defun cuda-ts-mode--simple-indent-rules () > (let ((cpp-rules (c-ts-mode--simple-indent-rules > 'cpp c-ts-mode-indent-style))) > `((cuda . ,(alist-get 'cpp cpp-rules))))) > > >(setq-local treesit-simple-indent-rules > (cuda-ts-mode--simple-indent-rules)) >``` > >In order to manage it properly > >2. I see that font-lock is working, but the fontlock rules check is >using the cpp parser. > >That's because the c-ts-mode--font-lock-settings still receives cpp as input. >I am trying to find a way to get it from c++ and then change the >:language cpp >with >:language cuda >because if I call >(c-ts-mode--font-lock-settings 'cuda) I obviously get an error. > >Is there some way to go around these in a cleaner way? > >Thanks in advance and thanks, >Ergus > > >On Mon, Aug 19, 2024 at 08:44:41PM -0700, Yuan Fu wrote: >> >>Hey Ergus, sorry for the delay. >> >>>On Aug 12, 2024, at 4:10 PM, Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@HIDDEN> wrote: >>> >>>Hi Yuan: >>> >>>I am just trying to use the new treesit-language-remap-alist and so far >>>I understand your idea of how to make it work for the basics. But it is >>>not clear how can I use the new var to add the new syntax entries. >>> >>>I mean, looking at the grammar: >>> >>>https://github.com/tree-sitter-grammars/tree-sitter-cuda/blob/master/grammar.js >>> >>>You can see that it is the inherited C++ syntax, with extra entries in >>>some fields (like _declaration_modifiers or delete_expression). For this >>>part the new variable may work perfectly. >>> >>>However there are a few "new" entries like: kernel_call_expression, >>>kernel_call_syntax and launch_bounds that will need special handling. >>> >>>What's your suggestion? >>> >>>I mean, for the latest what we really need is to extend (partially >>>redefine) the c-ts-mode--indent-styles, c-ts-mode--keywords and so on. >>> >>>Is that the intended approach? >> >>Yeah, you can define your own cuda-indent-styles by grabbing c-ts-mode—indent-styles and adding your rules on top of it, something like >> >>(append your-styles >> (c-ts-mode--indent-styles 'c++)) >> >>For font-lock, something like >> >>(append (treesit-font-lock-rules >> :language 'cuda >> :faeture 'xxx >> '(queries)) >> (c-ts-mode--font-lock-settings 'c++)) >> >>The new treesit-language-remap-alist will ensure that even though the config you borrow from c-ts-mode calls for c++, Emacs will actually use cuda grammar in your major mode. >> >>Yuan
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 16 Jan 2025 19:35:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 16 14:35:56 2025
Received: from localhost ([127.0.0.1]:34719 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tYVel-0005u2-II
for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 14:35:55 -0500
Received: from sonic304-10.consmr.mail.bf2.yahoo.com ([74.6.128.33]:39184)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1tYVej-0005tm-3F
for 72388 <at> debbugs.gnu.org; Thu, 16 Jan 2025 14:35:54 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
t=1737056146; bh=2cjv/IN/rhAOwZcOqV3MRQeq2besTzAw9R9wQAIALDA=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To;
b=h0isN1klYn7MwyDnmIGObo8h3+e3AKj8TvsdqLg5IC8csPpuKwToZJiTmSZ1UhUmIJNk0zddM1ui7UTANvRb4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53ESm7eiGm.JHSYbHwwXnrLO1bAhbu9ItTZ6OsdWWPq51k...zMTf0Cpx
.RfbSWHPgQ71fjCusqV3SqF_VF_ycV1e9pdGOE4PBQ2j4wG2UM5ubiOM0XoE5nLLT5jpkWan2a3m
DrrvFF4Yzg6sBroXlJPx2gL4XouI45P0lJjX8oTNMuTDZCAocgQnwsRj_G38ZvR.EkVYLdJ7t4ey
zuf_wxnFFvN3zrC3yip9SmL.7cIRP3Nz0EM76wtGO8hGIe.Bx_K7S8uCh51AJIElNuUtREE9RFMU
kXvbIKS3OGh3Z9B5MHKjfrsYbKFbnY4W.TpQSuI953riv3GdsXuEMmtsjxS8sGW48doAvYDb25pp
Me01QcgOxMoX7ygveVSMvQcBAZrBNS7REyqSpUxW1InaDOGr1V8qv5VcLJWlIpJZ0ZNZBS5LhpK_
rS2NZfV_vKmUo10wb55DcsUqx4IbZrZQA2Jo_b87p1SaTG13k8mwj05e24K_WaQ7uOtoeuPoh52z
rJz5zB8jYzEZwSdOkfX_K2UuFQzaPqIFLdYu_1mIjcu55pUar2421ZqI9uG_VcQm0lB_wqsKWygE
lADoNPpzS4nn8Rtc22QBIc4eM67t0mhO4Nc1n_QPwZRPMQyz7HJqEZxq6eWlMz_7U66DHJkNtoF6
DmvQWxKtftDYYWbMQD30hvh4U8BG5OqloKVQ69ZeAORMcwJrXN_BDtA7vlMN0ev3BsfuIIWIfV7_
hebugSTvjnk4Ui1NOP16VpIdj88GN46DKhcK5KJL_aooOM35CJU1HrTqr6hzCReFeuk9X1sGreu3
f0P5NVH5iPbT5wQgnMpgD.1_WHK9panx3.wDw3JkwY8TWLS75Fn2Qls.g9wXvpnFftp1q1FQUjra
3
X-Sonic-MF: <spacibba@HIDDEN>
X-Sonic-ID: e6d0df47-ecf1-4700-9fff-033f667d1e96
Received: from sonic.gate.mail.ne1.yahoo.com by
sonic304.consmr.mail.bf2.yahoo.com with HTTP; Thu, 16 Jan 2025 19:35:46 +0000
Received: by hermes--production-ir2-c694d79d9-8xldd (Yahoo Inc. Hermes SMTP
Server) with ESMTPA ID 90d30304a591acb51a56daf1da987309;
Thu, 16 Jan 2025 19:35:41 +0000 (UTC)
Date: Thu, 16 Jan 2025 20:35:39 +0100
From: Ergus <spacibba@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
Message-ID: <psff7evoy3t2og5bstvjmd7vnzltfkrdtbh6k7li253d4xyzg4@27lrhwqcq7rq>
References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y>
<j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
<1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
X-Mailer: WebService/1.1.23187
mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol
Content-Length: 2877
X-Spam-Score: -1.8 (-)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.8 (--)
Hi Yuan:
It has been a long time since this emails.. But today finally I made my
serious attempt to make a `cuda-ts-mode`.
While the treesit-language-remap-alist helped to reuse an important part
of the code, there were a few issues I needed to manage manually and
maybe they could be improved somehow:
1. The indentation rules still uses the 'cpp prefix, so I had to
manually tune the code:
```
(defun cuda-ts-mode--simple-indent-rules ()
(let ((cpp-rules (c-ts-mode--simple-indent-rules
'cpp c-ts-mode-indent-style)))
`((cuda . ,(alist-get 'cpp cpp-rules)))))
(setq-local treesit-simple-indent-rules
(cuda-ts-mode--simple-indent-rules))
```
In order to manage it properly
2. I see that font-lock is working, but the fontlock rules check is
using the cpp parser.
That's because the c-ts-mode--font-lock-settings still receives cpp as input.
I am trying to find a way to get it from c++ and then change the
:language cpp
with
:language cuda
because if I call
(c-ts-mode--font-lock-settings 'cuda) I obviously get an error.
Is there some way to go around these in a cleaner way?
Thanks in advance and thanks,
Ergus
On Mon, Aug 19, 2024 at 08:44:41PM -0700, Yuan Fu wrote:
>
>Hey Ergus, sorry for the delay.
>
>> On Aug 12, 2024, at 4:10 PM, Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@HIDDEN> wrote:
>>
>> Hi Yuan:
>>
>> I am just trying to use the new treesit-language-remap-alist and so far
>> I understand your idea of how to make it work for the basics. But it is
>> not clear how can I use the new var to add the new syntax entries.
>>
>> I mean, looking at the grammar:
>>
>> https://github.com/tree-sitter-grammars/tree-sitter-cuda/blob/master/grammar.js
>>
>> You can see that it is the inherited C++ syntax, with extra entries in
>> some fields (like _declaration_modifiers or delete_expression). For this
>> part the new variable may work perfectly.
>>
>> However there are a few "new" entries like: kernel_call_expression,
>> kernel_call_syntax and launch_bounds that will need special handling.
>>
>> What's your suggestion?
>>
>> I mean, for the latest what we really need is to extend (partially
>> redefine) the c-ts-mode--indent-styles, c-ts-mode--keywords and so on.
>>
>> Is that the intended approach?
>
>Yeah, you can define your own cuda-indent-styles by grabbing c-ts-mode—indent-styles and adding your rules on top of it, something like
>
>(append your-styles
> (c-ts-mode--indent-styles 'c++))
>
>For font-lock, something like
>
>(append (treesit-font-lock-rules
> :language 'cuda
> :faeture 'xxx
> '(queries))
> (c-ts-mode--font-lock-settings 'c++))
>
>The new treesit-language-remap-alist will ensure that even though the config you borrow from c-ts-mode calls for c++, Emacs will actually use cuda grammar in your major mode.
>
>Yuan
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
Received: (at 72388) by debbugs.gnu.org; 20 Aug 2024 03:46:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 19 23:46:43 2024
Received: from localhost ([127.0.0.1]:59529 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1sgFpT-0002s8-DP
for submit <at> debbugs.gnu.org; Mon, 19 Aug 2024 23:46:43 -0400
Received: from mail-pj1-f54.google.com ([209.85.216.54]:44530)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <casouri@HIDDEN>) id 1sgFpR-0002rq-Qc
for 72388 <at> debbugs.gnu.org; Mon, 19 Aug 2024 23:46:42 -0400
Received: by mail-pj1-f54.google.com with SMTP id
98e67ed59e1d1-2d3bae081efso3692421a91.1
for <72388 <at> debbugs.gnu.org>; Mon, 19 Aug 2024 20:45:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1724125493; x=1724730293; darn=debbugs.gnu.org;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=2PWEtQ4mNoJb2MweOOq4KNMJMZwXYXVIS3+Lln93qxc=;
b=QJGBh4elr3P2NYSyBYI6EgwZFf6wDk4HTgQOchYF58p2QrrBhapIKdMU1H1xAkaaGs
Gvry9t7tUqpKu/zTlo5nWmR2oYmGSiBtohWbo6QsRMiC0JHl/jdzv7WWm9iztG50zEek
6W2EhYY2hPeNOkSctHLLCiTXqnqADCcjZQGGccYoa740CSPQkiQUtBX5fznkJ8ZU/o3o
doNCf7O/X7asQdc5775y2Z/JYwWOpIeUVxW1qVrGA2taRM0j9ublecSBIwk4trpVnq4a
bQGiA6Lon2SY1BpAZNkqWf65ZLAB6WKWRVIGtvLHtLvXzkLP+pHjT3ZfAmj+NZuQ/yc3
ETAg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1724125493; x=1724730293;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=2PWEtQ4mNoJb2MweOOq4KNMJMZwXYXVIS3+Lln93qxc=;
b=QMMH34K6FXRlwmoc8k/vWj+jPgI9YMyOwqi5/0HUgU6Jids8UVKnyR6lR+Ru3hyY9O
gL0h0jNivcqOF0+A8yn1bKoyXT9qllFURXNrQAmu3PSCAk7rmEp3+DbEs6nTNESGyPWC
ZYlcBYX1TViR21v7fXkOTRqxFBkLyw/BLH7WtrH7G9Of0+j/xWe9a5Qx12+SyKGA6mfk
dpqYB6Iso24/HaiieCl2kS3qh1d7pxsodblF6ew+teTxXHDHGWU+53tkyJku8YBPbI1h
axiiF/iToZBO6FCyorqWqaE0/7nRvnKDsD9ooAGboD+BmUf8CIsDGl3T3gvYaZA2VQ2U
nKLA==
X-Gm-Message-State: AOJu0Yx8cw8dgVzW1tym1VeN/m5SyggxfXTc/7m19qMaaJiuHHoN16bS
+NSxfNAxYcUU5iplKDKnnLj7wMY281Q72lfX8snpE6U+jthYr+Ex
X-Google-Smtp-Source: AGHT+IHiq4/UroCb2e/5tATiohbw2KtIMWq9b37ZfKwpOEpp1nwxJ6xR/RAxXL6v6pOrLuUeC9XzIA==
X-Received: by 2002:a17:90a:e7cc:b0:2cd:2992:e8dc with SMTP id
98e67ed59e1d1-2d5c0d79fcdmr1250169a91.5.1724125493419;
Mon, 19 Aug 2024 20:44:53 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:edc4:5dff:2f35:3b4a])
by smtp.gmail.com with ESMTPSA id
98e67ed59e1d1-2d3e2e6b2d1sm8187199a91.18.2024.08.19.20.44.52
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Mon, 19 Aug 2024 20:44:52 -0700 (PDT)
Content-Type: text/plain;
charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with
tree-sitter-cpp's font-lock/indentation rules
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
Date: Mon, 19 Aug 2024 20:44:41 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <1D62877B-C528-4B0B-95E2-8CF8CC79F355@HIDDEN>
References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y>
<j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y>
To: Ergus <spacibba@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72388
Cc: 72388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hey Ergus, sorry for the delay.
> On Aug 12, 2024, at 4:10=E2=80=AFPM, Ergus via Bug reports for GNU =
Emacs, the Swiss army knife of text editors <bug-gnu-emacs@HIDDEN> =
wrote:
>=20
> Hi Yuan:
>=20
> I am just trying to use the new treesit-language-remap-alist and so =
far
> I understand your idea of how to make it work for the basics. But it =
is
> not clear how can I use the new var to add the new syntax entries.
>=20
> I mean, looking at the grammar:
>=20
> =
https://github.com/tree-sitter-grammars/tree-sitter-cuda/blob/master/gramm=
ar.js
>=20
> You can see that it is the inherited C++ syntax, with extra entries in
> some fields (like _declaration_modifiers or delete_expression). For =
this
> part the new variable may work perfectly.
>=20
> However there are a few "new" entries like: kernel_call_expression,
> kernel_call_syntax and launch_bounds that will need special handling.
>=20
> What's your suggestion?
>=20
> I mean, for the latest what we really need is to extend (partially
> redefine) the c-ts-mode--indent-styles, c-ts-mode--keywords and so on.
>=20
> Is that the intended approach?
Yeah, you can define your own cuda-indent-styles by grabbing =
c-ts-mode=E2=80=94indent-styles and adding your rules on top of it, =
something like
(append your-styles
(c-ts-mode--indent-styles 'c++))
For font-lock, something like
(append (treesit-font-lock-rules
:language 'cuda
:faeture 'xxx
'(queries))
(c-ts-mode--font-lock-settings 'c++))
The new treesit-language-remap-alist will ensure that even though the =
config you borrow from c-ts-mode calls for c++, Emacs will actually use =
cuda grammar in your major mode.
Yuan=
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.Received: (at 72388) by debbugs.gnu.org; 12 Aug 2024 23:11:46 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 12 19:11:46 2024 Received: from localhost ([127.0.0.1]:43929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sdeCY-0007lp-8F for submit <at> debbugs.gnu.org; Mon, 12 Aug 2024 19:11:46 -0400 Received: from sonic305-3.consmr.mail.bf2.yahoo.com ([74.6.133.42]:34262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <spacibba@HIDDEN>) id 1sdeCU-0007lR-M0 for 72388 <at> debbugs.gnu.org; Mon, 12 Aug 2024 19:11:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1723504263; bh=x9v5V/5F3IcJd/YM5ENwXg72Odqh9sTG/i4rtpsgBHQ=; h=Date:From:To:Cc:Subject:References:From:Subject:Reply-To; b=fgrMuPF3bitMvPHAMccZi9VbcE/+x2QiAcBQ/H9jWphIv0BDl8nYzr2HForGtku3uKpKqHRwPtew8WP0qct8NYDzt9mhg6HbIRUZEQTocxIUgtA9L+Cqx7sjxkHxxAzcMqn/mM0Hyc283QblvTXnwYzLYQcF9xdwd+bPKk7eoraU6LaYb7/L7zPEA2w7RiUVxqRHa+6iZGgucLsuKDugJ+1Hhz5kJ/wnV7YE3CI6ibAcdYi6as8OW9JO/SbJG9bg/JWFBn4gIL82GDgiWlsOaSqFwbazN1ANJm94vOadpuvE6sZjaYd5jxcmNQh7TVdW+ZQwzLe3/AxVyvalNTFxWg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1723504263; bh=2JudAyeueYnyj1H7tR+xYTQZRgUrLJh7ZfCoLXpPw9+=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=uk1TbxdI8/dLtz/iRLPT2gDsArlLzxXVCzOuHBGPyw2DqeNkMMagsuMF/agMbfHHYEdgA8RMhNQ4S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emNJ3.Pby3QAEzsuBU54vohFLg8qoeDUZj 1lZE.ah7_e1UTeItxVj_GxmSjykgal6IihHJGf7PPfP5C_vloLmPFPM3kU68ywOOiu2o9oPZf9XS KQ73MAKsbV.FZEGsGBTDu4acCqD5hTXMKlcirMsiCB1q_qTHav64kKzjSAPviL0JDSlPT.QjzOw9 T30h0v6NPk1gqGX_2rqMWZ1HU9AJm1y0KcFR19sjeXkmT_TvYyqA6y8zzMvs0adzZF9p0IeQXX7G W0plarHGNKWKQsAT.sVto06wwOxQvinmpI_Ov3d3NmYhNwYc78w3Z5gclDDva6g.uT_a73BeEiOb MCxEbHDNkibTveg8fDxecgdNjvEhLCz091.AgIteHWj6va9N0hkoiPVBA6zsiXQx.mbRZqHZPDJo c00PNsmL8nte3gmGo X-Sonic-MF: <spacibba@HIDDEN> X-Sonic-ID: 5120933f-20a0-47e7-9a11-07763b30fe12 Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Mon, 12 Aug 2024 23:11:03 +0000 Received: by hermes--production-ir2-6664f499fc-lsbf5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 0088df222f9faeaba22526d8a9a056e3; Mon, 12 Aug 2024 23:10:59 +0000 (UTC) Date: Tue, 13 Aug 2024 01:10:57 +0200 From: Ergus <spacibba@HIDDEN> To: 72388 <at> debbugs.gnu.org Subject: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules Message-ID: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy@sl3msvhlp73y> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline References: <j77vrtrwipskv52jzhoilntlm2gqamvt7ledyeuxkugrsh7ojy.ref@sl3msvhlp73y> X-Mailer: WebService/1.1.22544 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Content-Length: 870 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72388 Cc: Yuan Fu <casouri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Yuan: I am just trying to use the new treesit-language-remap-alist and so far I understand your idea of how to make it work for the basics. But it is not clear how can I use the new var to add the new syntax entries. I mean, looking at the grammar: https://github.com/tree-sitter-grammars/tree-sitter-cuda/blob/master/grammar.js You can see that it is the inherited C++ syntax, with extra entries in some fields (like _declaration_modifiers or delete_expression). For this part the new variable may work perfectly. However there are a few "new" entries like: kernel_call_expression, kernel_call_syntax and launch_bounds that will need special handling. What's your suggestion? I mean, for the latest what we really need is to extend (partially redefine) the c-ts-mode--indent-styles, c-ts-mode--keywords and so on. Is that the intended approach? Best, Ergus
bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.Received: (at submit) by debbugs.gnu.org; 31 Jul 2024 00:06:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 30 20:06:24 2024 Received: from localhost ([127.0.0.1]:48741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sYwrI-0004eG-Cz for submit <at> debbugs.gnu.org; Tue, 30 Jul 2024 20:06:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:45700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1sYwrD-0004e4-Ll for submit <at> debbugs.gnu.org; Tue, 30 Jul 2024 20:06:22 -0400 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 <casouri@HIDDEN>) id 1sYwqy-0004vF-76 for bug-gnu-emacs@HIDDEN; Tue, 30 Jul 2024 20:06:04 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <casouri@HIDDEN>) id 1sYwqw-0000J7-Ok for bug-gnu-emacs@HIDDEN; Tue, 30 Jul 2024 20:06:03 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1fd78c165eeso43879445ad.2 for <bug-gnu-emacs@HIDDEN>; Tue, 30 Jul 2024 17:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722384360; x=1722989160; darn=gnu.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=xxu7EIGShMOjyvdp8JXdUqsk/+YA/x/IL9MJ8PYrcJE=; b=T2RibJVOxP630piiIz0YFwm0s05eN3iZPw6yWBh/yLrY3bcSKjI5grgHDxfqkxLBTq elXKuIAzH1c/nSyEfdSVWr/6mrbdftbHZap9SGjh2gMGusS5Bj46EM2F3fp+ORy9a1PI JjRohzZ+9ym4gJRU1dXaa62dN6+FOaKTvlMcYJUFi0Us2QLdjlRsbdsXTq+PAtBwFA/z 3ZLg/DMmvQ48W1HlBRDzmmqn8QGjfbhL2w+2JANTrcFxRV9SbY9RsNjKvxEYIBvmKBoV EShWkkk5sIsjYb15w1eKjFba3Ef/NS/+OhmQS3UoPH3zsLz5a8vZXefYhhlanMwHGU0n xzoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722384360; x=1722989160; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xxu7EIGShMOjyvdp8JXdUqsk/+YA/x/IL9MJ8PYrcJE=; b=tKsdtRRHGw/LizKr5chyMiSdpW5p0E8oQSYPllAvCdirKUMSJRVBCw0uQhJxMYzmHP eDaTOOfrvD/asofFvEdbhpgqGLCJsorUCpOa4gOnBy8keHYacqSeO6h9ZgdCqFtXeEOo dWr2slxiikIFr3kDohIvRzUa0L57uOze8pPostn9/cnO7ZtaRYyCGUCfX/k4Y6G2naDP ghJfr4Xbe17HVqaHMciOwiJF4pI3iIcziV5wBXd9V7SEx10EOXESJRrLfLEwOUmVe24v tscYfm+G3UnRPWLt5h6Ss/Z01kv4YIGkul9pWRJzKHWY9nGVf+Rvm2dbssbE5HOIy5qC WOiQ== X-Gm-Message-State: AOJu0YzD1GJ/xEw2frOIMyRcIe0hmELW3DSdbx3Ru2r2nwilt0rehfuZ R0FmDR5WsYwby7FFA1t4dccEUHBO7+lg4+eCmvsTT6hwOgCcIwnzXaUolQ== X-Google-Smtp-Source: AGHT+IEEYcmCM1jL5Hl06bISoSM7h2Yxkm8ZdNojM80h3vntII5lbZUQ5mwZPCp0a++etaKvh3tn2Q== X-Received: by 2002:a17:903:41cd:b0:1fd:9420:1073 with SMTP id d9443c01a7336-1ff048a9e37mr189586005ad.43.1722384359868; Tue, 30 Jul 2024 17:05:59 -0700 (PDT) Received: from smtpclient.apple ([2601:646:8f81:6120:4c7a:ac4b:4762:593e]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7ff65f4sm107774125ad.300.2024.07.30.17.05.59 for <bug-gnu-emacs@HIDDEN> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jul 2024 17:05:59 -0700 (PDT) From: Yuan Fu <casouri@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules Message-Id: <4138B715-7C8D-4904-8D0A-616BA556AD4C@HIDDEN> Date: Tue, 30 Jul 2024 17:05:48 -0700 To: Bug Report Emacs <bug-gnu-emacs@HIDDEN> X-Mailer: Apple Mail (2.3774.600.62) Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=casouri@HIDDEN; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) Originated from "Implementing cuda-ts-mode=E2=80=9D on emacs-devel [1]. = Basically we want to create a major mode for tree-sitter-cuda. = Tree-sitter-cuda grammar is basically cpp grammar plus some cuda rules. = So it makes sense to reuse cpp mode=E2=80=99s font-lock/indentation = rules. But those rules directs to the =E2=80=98cpp grammar. A simple = solution is to allow users to map one language to another; then when = ever lisp tries to create or get a parser for lang A, lang B is used. Yuan [1] Message-ID: = <v2a2js5ssoz7d3hquenaieubgmj263tz3ejbogordd5t3ys4v2@efpjojlxrlv4>=
Yuan Fu <casouri@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#72388; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.