From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#72388: 31.0.50; Use tree-sitter-cuda grammar but with tree-sitter-cpp's font-lock/indentation rules Date: Mon, 19 Aug 2024 20:44:41 -0700 Message-ID: <1D62877B-C528-4B0B-95E2-8CF8CC79F355@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19979"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72388@debbugs.gnu.org To: Ergus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 20 05:46:51 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgFpb-00054X-5u for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Aug 2024 05:46:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgFp7-0006E8-4s; Mon, 19 Aug 2024 23:46:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgFp6-0006Dz-7r for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2024 23:46:20 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgFp5-0004AZ-S7 for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2024 23:46:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=2PWEtQ4mNoJb2MweOOq4KNMJMZwXYXVIS3+Lln93qxc=; b=tz9y/YSbwKKWCvGlJq+NExlFZoahBCDKZHaVE5wCuBnFiBhV6kR2IIbqgc2unYPz5eb6onshfaDJkB8Os0QBqu8Y49EG8A4yVbLrH2u4yyTGpM1idlZh2H2GSgGdi2dvoSfsmZq0eY/n6emEfvx/q8OM+NqoAEp5tnPJydfYlJ2aTzTFlISQnI2ID3EYJK+wXKUot7caRTveoPTQ6LZRx+5Qj9aDTFEZkReiDDJS0IvJGBXwHHG5iRi/okUx2ddhiJeWf0/0Mx+bCgzeGjpteTCBkLQgxNLXAfmNdNkOHBsG8UDEK9Bah4dyh0G2ydWhJHTSv6mxgW3S3uTUU/MZzg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sgFpm-0002sx-9z for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2024 23:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Aug 2024 03:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72388 X-GNU-PR-Package: emacs Original-Received: via spool by 72388-submit@debbugs.gnu.org id=B72388.172412560311049 (code B ref 72388); Tue, 20 Aug 2024 03:47:02 +0000 Original-Received: (at 72388) by debbugs.gnu.org; 20 Aug 2024 03:46:43 +0000 Original-Received: from localhost ([127.0.0.1]:59529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgFpT-0002s8-DP for submit@debbugs.gnu.org; Mon, 19 Aug 2024 23:46:43 -0400 Original-Received: from mail-pj1-f54.google.com ([209.85.216.54]:44530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgFpR-0002rq-Qc for 72388@debbugs.gnu.org; Mon, 19 Aug 2024 23:46:42 -0400 Original-Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2d3bae081efso3692421a91.1 for <72388@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) Original-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) In-Reply-To: X-Mailer: Apple Mail (2.3774.600.62) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290421 Archived-At: 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 = 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=