From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filippo Argiolas Newsgroups: gmane.emacs.devel Subject: Re: A few questions about c++-ts-mode. Date: Thu, 9 May 2024 08:11:53 +0200 Message-ID: References: <865xvoa0jr.fsf@gnu.org> <86jzk38tm7.fsf@gnu.org> <86cypv8rb6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1249"; mail-complaints-to="usenet@ciao.gmane.io" Cc: spacibba@aol.com, emacs-devel@gnu.org, casouri@gmail.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 09 08:13:19 2024 Return-path: Envelope-to: ged-emacs-devel@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 1s4x1q-0000Hk-OW for ged-emacs-devel@m.gmane-mx.org; Thu, 09 May 2024 08:13:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4x17-0001zA-DN; Thu, 09 May 2024 02:12:33 -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 1s4x0r-0001m8-TP for emacs-devel@gnu.org; Thu, 09 May 2024 02:12:25 -0400 Original-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 ) id 1s4x0o-00076Z-8b; Thu, 09 May 2024 02:12:17 -0400 Original-Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e4c4fb6af3so3303395ad.0; Wed, 08 May 2024 23:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715235125; x=1715839925; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=g0Ux+miA39sawVktisk74Zj3yfxA4jDDAptcUOGFDYE=; b=GUUsgMDf8H9WfayVvP9KNFA9kdWALteEGUayNWWL8Ofy5Sl5eOzV2GNgOZOP9HL2j1 cGcJObsV+SSWwKvQ1xOIeHhrDf1EN6mfdxQtRavcOLid/vgGqIMZbAcIKdnM/05KW5FF Lh09I7ufQVg6+/VhRYV+iqyrdATgQgnTZtifXmZlcVAERKS8qV+8h2tHiaox9ho2x2tH c9UTO4tDcVdTr3pXyuIxwUIWuuKyyNupuV+r+/nsOQAYsC4BwTt2tI7j2h80OTcxJtNX x7a9jYP5Y0P1PB2BYd0lPtQIGBT9ad2J73ABFGkBS1RH1lpvX150auFkk83nrn99teQj 7aDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715235125; x=1715839925; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g0Ux+miA39sawVktisk74Zj3yfxA4jDDAptcUOGFDYE=; b=MB9gWMYVU7nqnWLMPsQKUQbozU8S7bD5cQajSnPzjQ9fYarKevGJOpC9cFNdx7xIn5 +Tr5bSL9we0nTZuxUF175oSb37wuBzCdSoOFqZM2HtO9zPTIs/pf8Eu+Y5eaINYovELi gXH4CCjIXRXliTlVenSRuQE2/wCmK8Whr39vfWxXeAvXR8MlwP1L6Q/N+lJO3OK3om7n 8HO5K3xVLjMUPmW7KoOkmuSejAtrkXX59RrYAK0UW+GWyVZq2SSadAx12Ap+oiyDzSbM +6rMDLP3RpDKVXQDcol43UEJp5J5SNxwCTfatmDp4XEeFlmQQLCel2L7FAC30dczgIVa VExw== X-Forwarded-Encrypted: i=1; AJvYcCV9O1ton71wwZOWG7jM47EmB3zOw3f2HEs5fQT+bw6gGII0VA+4MNKeg+IMe4X3930lQqRZjEwjeb9fljI0xTSDldWK X-Gm-Message-State: AOJu0Yy8v1aXoRAQkgmUHcn1Mql0HT4pRmvh4fD5rZphWoMPzycMDbU8 c990j6Xy/bcBPVO0t9c347lHs4CFP2sw+Zjh6UZYQ0S7Pkqrz3vDWsun3ZAJ311hT7uACJahSJ3 ebJLxTlmYhBVMAemQSYQg0QVscjnRR6qt X-Google-Smtp-Source: AGHT+IHrVZbygCnIxeJhy1VX/Cl2oGdhXP5VmhdspWjw3ywtdADdVjXjreFX3CqgSrxnErJNRG65Rw4zMbQ4gBs6HNQ= X-Received: by 2002:a17:902:cf11:b0:1e2:58f:7ed4 with SMTP id d9443c01a7336-1eef9f417b4mr32305045ad.5.1715235125190; Wed, 08 May 2024 23:12:05 -0700 (PDT) In-Reply-To: <86cypv8rb6.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=filippo.argiolas@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319044 Archived-At: On Thu, May 9, 2024 at 7:53=E2=80=AFAM Eli Zaretskii wrote: > > > From: Filippo Argiolas > > Date: Thu, 9 May 2024 07:34:58 +0200 > > Cc: Ergus , emacs-devel@gnu.org, casouri@gmail.com > > > > > If the only solution is language injection, then doing that our usual > > > way (with regexps etc.) is easier and more flexible. I thought I saw > > > some commits in the C++ grammar that actually support that in the > > > grammar itself. If there is such support, we should use it, IMO. > > > > > > > Sorry to intrude, may I ask what's the problem with language > > injection? it seems the perfect use case for this. > > I didn't say there was a problem, I said that doing it with regexp > etc. would be easier and more flexible. > > Language injection AFAIU requires an additional grammar library, which > means someone must compile it, the end-user must ensure it's > installed, etc. IOW, it makes the disadvantages of tree-sitter more > prominent, for the benefit of a very minor feature. From where I > stand, that makes the balance tip in favor of the simpler solution, > which users could more easily activate and customize. Thanks for the clarification! I thought there was some intrinsic limitation either in the injection feature or in emacs support for it. Agree that requiring an extra grammar just for highlighting a couple of @keywords would be too cumbersome. OTOH from what I can tell injections seem popular in the nvim world so that must not be that cumbersome for the users. By the way, about printf format strings I was experimenting a bit here [1] but refrained from proposing it upstream with the assumption that it would be refused like for the tree-sitter-go pull request[2]. 1. https://github.com/tree-sitter/tree-sitter-c/commit/fecec922c21b79ef8385= 1f5028910bc316fcd8e1 2. https://github.com/tree-sitter/tree-sitter-go/pull/88