From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Missing features in c-ts-mode Date: Fri, 17 Feb 2023 19:10:28 +0100 Message-ID: <2544C83B-0E08-4E67-9349-361603871946@thornhill.no> References: <87a61e7n5j.fsf@thornhill.no> <877cwi7mju.fsf@thornhill.no> <83bkluaevv.fsf@gnu.org> <871qmq7l9q.fsf@thornhill.no> <87ilg1qv71.fsf@thornhill.no> <20230217082935.waa7f473dmvbpg3d@Ergus> <87fsb4r4xf.fsf@thornhill.no> <83k00g1o0k.fsf@gnu.org> <20230217163747.yt5kizq6e4vqmqqe@Ergus> <437CB8E1-1BBA-42A8-BADE-9F729A7AC5CA@thornhill.no> <20230217180228.nzm3wsnxdkjswxiy@Ergus> 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="14773"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , casouri@gmail.com, emacs-devel@gnu.org To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 17 19:11:31 2023 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 1pT5Ck-0003d5-6t for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Feb 2023 19:11:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pT5Bt-0003t9-SN; Fri, 17 Feb 2023 13:10:37 -0500 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 1pT5Bs-0003pU-5S for emacs-devel@gnu.org; Fri, 17 Feb 2023 13:10:36 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pT5Bp-0000z9-JE; Fri, 17 Feb 2023 13:10:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1676657431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UrJva1vuyCK/Rtf2kD0MEEBd2Q8g51aNNfAOde0bYNw=; b=a/7OyUqTlGxZn806s7yeUfoJdkGfyTW72q1DiGnxAD4WxCw2eb/zrQJgv2nOPkx7Nhq4Uz 8MHBP31DwaVuFcXaoyNDtIH6gvjzN9/8cKu5lnJ0LE/Pk5kWWsN/kK8qWlhqrG56Rll6Tg vlkaalI5xV5ptxNpRd/7QBld42xPWsyNxO9kgMHKlLOiyY5N+CE9bJSTa1bnx79KlmGr6N y0+JUt0f4ABYZcLjGHB9B6+xPHUtAdD5s/XY9MJ2uP1nN8KOzTNcdiG26S4PjQ9PmkH9SL 37CSaKoieRsY9KLplTvuJyPoRn3Weaw1EY2g4Uch6TSL3NSq+wi7MN2k76Zuog== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <20230217180228.nzm3wsnxdkjswxiy@Ergus> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=theo@thornhill.no; helo=out2.migadu.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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:303510 Archived-At: On 17 February 2023 19:02:28 CET, Ergus wrote: >On Fri, Feb 17, 2023 at 06:34:34PM +0100, Theodor Thornhill wrote: >>=20 >>=20 >> On 17 February 2023 17:37:47 CET, Ergus wrote: >>> Hi Eli and Theo: >>>=20 >>> Yes, I know that the feature is not very "popular" to be enabled by >>> default, but for parallel programming models based on pragmas (OpenMP, >>> OmpSs, OpenACC) it is very important=2E >>>=20 >>> Many people in my previous work moved to some other editor after years >>> using emacs due to these apparently "small" details=2E Every time they >>> wanted to indent a portion of code (i=2Ee they added an if around it),= all >>> the pragmas moved out of their place and needed manual fix=2E >>>=20 >>> On that moment I commented with Alan the possibility to make #pragma a >>> syntactc symbol which we could control its indentation like anything >>> else in c-mode (with +, ++, -, 0 or [0])=2E But he said that it requir= ed >>> too many changes to implement that and offered this "toggle" solution >>> good enough for me=2E >>>=20 >>> I will open the feature request in a moment, but just wanted to commen= t >>> the alternative solution more consistent and without an extra mode; >>> because maybe that way may be simpler now in the new mode?? >>>=20 >>> Best, >>> Ergus >>>=20 >>> On Fri, Feb 17, 2023 at 02:20:59PM +0200, Eli Zaretskii wrote: >>>>> From: Theodor Thornhill >>>>> Cc: Eli Zaretskii , casouri@gmail=2Ecom, emacs-devel= @gnu=2Eorg >>>>> Date: Fri, 17 Feb 2023 10:56:28 +0100 >>>>>=20 >>>>> > #pragma parallel for first private(x) \ >>>>> > shared(y) etc >>>>> > for (=2E=2E=2E) { >>>>> > =2E=2E=2E=2E >>>>> > } >>>>> > } >>>>> > >>>>> > In this case the pragma in column zero is very confusing=2E Alan a= dded a >>>>> > new mode (c-toggle-cpp-indent-to-body) which worked around this is= sue a >>>>> > few years ago=2E I don't if it is possible to enable similar behav= ior with >>>>> > your change? Is is? >>>>> > >>>>> > Best, >>>>> > Ergus >>>>> > >>>>>=20 >>>>> It's absolutely possible, but IMO that sounds like an improvement fo= r >>>>> emacs 30, maybe? >>>>=20 >>>> It depends on how simple and safe the change will be=2E But yes, I'm >>>> okay with delaying this to Emacs 30 if the addition is complex enough= =2E >>>>=20 >>>> Thanks=2E >>>>=20 >>=20 >> Would this mean you'd want all preproc directives configurable, or only >> some in particular? I think a defcustom for either/or is doable for >> Emacs 29, but for granular control we'd need to think a bit more=2E >>=20 >> c-ts-mode-preproc-indent-to-body? > > >Hi Theo: > >AFAIK only #pragmas have this behavior, so I think a custom for #pragmas >may be enough if the alternative becomes complex or complicated=2E > >I commented the initial problem as it was just in case tree-sitter >already have all the spices to go for the general solution in a >"simpler" way, with a consistent syntax and without an extra >defcustom/toggle-mode=2E > >Maybe there is a point in between like treat #pragmas as a different >kind of directive than preproc (which they actually are BTW, #pragmas >are not exactly preprocesor directives, but hints for the compiler >itself)=2E > >In that case the user could write something more or less like: > ((node-is "pragma") parent 1) > ((node-is "pragma") no-indent) > >in the indent-style=2E > >WDYT? > Yep! Is there any particular style? Would pragmas be indented from the par= ent scope, and the next line after it be at the same level as the pragma?= =20 Theo