From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Missing features in c-ts-mode Date: Fri, 17 Feb 2023 19:02:28 +0100 Message-ID: <20230217180228.nzm3wsnxdkjswxiy@Ergus> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14103"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , casouri@gmail.com, emacs-devel@gnu.org To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 17 19:03:26 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 1pT54v-0003VC-IT for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Feb 2023 19:03:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pT54E-0001sq-9L; Fri, 17 Feb 2023 13:02:42 -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 1pT54D-0001sQ-5b for emacs-devel@gnu.org; Fri, 17 Feb 2023 13:02:41 -0500 Original-Received: from sonic306-2.consmr.mail.bf2.yahoo.com ([74.6.132.41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pT54A-0006QJ-CN for emacs-devel@gnu.org; Fri, 17 Feb 2023 13:02:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1676656955; bh=VVtp/hMF/ElnHt3L6CYYcGSFBLOfhB8L+/ahULeF5ro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=SIQowUopkIWuQQ1NBY4QF7wfKcKdr2oFfkAL6zYsqd26tG1ic7GAv2E0ksOsz/QKMSaz617jnr4QWaKSUTz3AsS0nSasvO740U1/23JlCb+Rl/VcWi7pRlzthYLc0gm1KQPUii0f54vZu/KvZXdBTOpl1YXcMp7Iuyn8LXiTZM4adP/jQblYCP2O24pLM4CPbDTpLYwqnmF1tf90pnZMNxKP58kx/ihiH0XF4OYgTilmB1UotFERLIQHf0dDVrhnloRhR5NXZ6lP36Dc1ndsHjLEDpzyORB0MxMaB0A3HBNahYPhx+tRfwTeR3Dz15Trvu0ojSH6BdnUhmXOA1KJuA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1676656955; bh=EMv2w45UywN3d3CYImowvQmDgvbMUPCFF3RvQR4SgIX=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=obzBgAtbpgdpEAl8ZJ/4sOjD5RScDEG7/s30MuS9kKncMkH4X5TENuLL8YUWt1LBiDRoO0bwtoSJ517dYvdncWPXJ0BSEXpdn4Yn9D2/YTJpQxE+7/1FuZL16Ha1m0OZ85Poh4ZshrXYpzOWT9EwGnwvWvls3vctjxj+rCKnDP/zOQAYYMBVnNHO+DfK7KAcIAgGfTU8et0KVN/Oe8uKbxazcW8aeOgk77YBoWT4bYCqeUtNdbkPaMleuaT1dp8xxpI6VzaQ10SV8DIVk11bMo2GVlJ/hkGwc8nBsOxSlzaN/1T6T+sTszBL5BGRukpzs8Q6lXe7RgBP2gFr2RP9Sw== X-YMail-OSG: 2UXgs6oVM1kK4KEq9Zn37wdIhmuXAtZxqZgZNFQ_NSbILCPGPq30G_IQzQMe1ny 6RQpgn.zTqVxBwI9pHc2f7KdjVpxDKXAnABKlCgIT5glva0hqVwAYAGz5OIAwzXi3P0n66tWUX_q gszjV3G0y2HIBTk38DGqWRxeU.Ujnpy6QPx._bPtiMIZ4lc95hePRrJQ.95o.cyHE2XkjKyvjHsq 0lf5t50weKYOinpsUx36rnm6aD5sU95AjG0yjgUf1nF.6kBw6vpy4M1NhKygz0PP6Vekisw.la9W hSyu4Tj.OrQM4aQvcWUUvzIThABxBlWaWnwCyDnhEMqUj2jEG_mHYkV3_B_tXAxbciaRKEbKFjD9 MD3YOCbSfux6MAkQ0gwmt4K4oCsVNdX0C3bNDSqv9.WFtrzbzSZrf5073bZScH5Wev.ji_VFTIYq 3pa9lOLkWQC6qGgaQxMsRVVdLPmIQRWP2T4SxnhXC2bGZCZEDjCb11ZMki3RqsojTJuxNi9Ad_Py YdKZBoNhKl2j7xUNxzWJgl8yWrl_TMhwHabHziCZx78mdBWx3Y88gzbDxI7rCq9c4ooR06k0rG_f abTVHe_gOiK.RFfgqDWetGGNpx_gIIb2LZvh0pdNuirSukLXDo3n.VI8vmsymcAvW0lwEBY7mUHZ SmaTM.LVXpizQAmGnwOWW9Kk2qWE3onLOU9OWbgYf474q6KGUiQu6PwRILYZHLwZawMk7LXhvmVR ls4t9BFSxPN3qC7ArUzJnm035scRr.jmh2KoNXNSwjIkRMV7EjU.aIQuCo4809p0KZxdzGRNLY.8 uchpZCV3.ezjc4fqvy_efJIERX.57pQF3slYcMhCTV X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.bf2.yahoo.com with HTTP; Fri, 17 Feb 2023 18:02:35 +0000 Original-Received: by hermes--production-ir2-65c64dfd66-hwhd6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID f0ee7ab8faaf04f5bb6706042008b4fc; Fri, 17 Feb 2023 18:02:30 +0000 (UTC) Content-Disposition: inline In-Reply-To: <437CB8E1-1BBA-42A8-BADE-9F729A7AC5CA@thornhill.no> X-Mailer: WebService/1.1.21183 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.132.41; envelope-from=spacibba@aol.com; helo=sonic306-2.consmr.mail.bf2.yahoo.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:303509 Archived-At: On Fri, Feb 17, 2023 at 06:34:34PM +0100, Theodor Thornhill wrote: > > >On 17 February 2023 17:37:47 CET, Ergus wrote: >>Hi Eli and Theo: >> >>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. >> >>Many people in my previous work moved to some other editor after years >>using emacs due to these apparently "small" details. Every time they >>wanted to indent a portion of code (i.e they added an if around it), all >>the pragmas moved out of their place and needed manual fix. >> >>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]). But he said that it required >>too many changes to implement that and offered this "toggle" solution >>good enough for me. >> >>I will open the feature request in a moment, but just wanted to comment >>the alternative solution more consistent and without an extra mode; >>because maybe that way may be simpler now in the new mode?? >> >>Best, >>Ergus >> >>On Fri, Feb 17, 2023 at 02:20:59PM +0200, Eli Zaretskii wrote: >>>> From: Theodor Thornhill >>>> Cc: Eli Zaretskii , casouri@gmail.com, emacs-devel@gnu.org >>>> Date: Fri, 17 Feb 2023 10:56:28 +0100 >>>> >>>> > #pragma parallel for first private(x) \ >>>> > shared(y) etc >>>> > for (...) { >>>> > .... >>>> > } >>>> > } >>>> > >>>> > In this case the pragma in column zero is very confusing. Alan added a >>>> > new mode (c-toggle-cpp-indent-to-body) which worked around this issue a >>>> > few years ago. I don't if it is possible to enable similar behavior with >>>> > your change? Is is? >>>> > >>>> > Best, >>>> > Ergus >>>> > >>>> >>>> It's absolutely possible, but IMO that sounds like an improvement for >>>> emacs 30, maybe? >>> >>> It depends on how simple and safe the change will be. But yes, I'm >>> okay with delaying this to Emacs 30 if the addition is complex enough. >>> >>> Thanks. >>> > >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. > >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. 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. 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). 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. WDYT?