GNU bug report logs - #61578
30.0.50; c-ts-mode feature request intendation pragmas

Previous Next

Package: emacs;

Reported by: Ergus <spacibba <at> aol.com>

Date: Fri, 17 Feb 2023 17:03:02 UTC

Severity: wishlist

Found in version 30.0.50

To reply to this bug, email your comments to 61578 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61578; Package emacs. (Fri, 17 Feb 2023 17:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ergus <spacibba <at> aol.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 17 Feb 2023 17:03:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ergus <spacibba <at> aol.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; c-ts-mode feature request intendation pragmas
Date: Fri, 17 Feb 2023 18:01:44 +0100
This is a feature request related with:

f1f571e Add electric indent for preproc directives

c-mode had by default the [0] indentation for #preprocesor directives,
but there are some use cases where that behavior is not desired (i.e
#pragma).

Actually there are even multi-line pragmas when using OpenMP and similes:

int main()
{
     #pragma omp parallel for first private(x) \
         shared(y) etc
     for (...) {
         ....
     }

     #pragma omp parallel
     {
        #pragma omp task
        {
         ...
        }
        #pragma omp taskwait
     }
}

In these cases the pragma in column zero will very confusing.

Some years ago Alan added a new mode (c-toggle-cpp-indent-to-body) which
worked around this issue.

At that moment I requested the possibility to make #pragma a syntactic
symbol to control its indentation consistently like anything else in
c-mode (C-c C-o and +, ++, -, 0 or [0]). But such approach required too
many changes in c-mode, so he offered this "toggle" solution.

Now with three-sitter, is it possible to add some way to produce the
desired behavior? Either with a mode as it is in c-mode; or (probably
better) by adding some syntactic entry like: (node-is pragma) in the new
ts-mode indentation function?

I prefer the second one because it seems more consistent with the rest
of the syntax, and not an exception. But I am fine with any solution.

Best, and thanks in advance,
Ergus





This bug report was last modified 1 year and 40 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.