unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61578: 30.0.50; c-ts-mode feature request intendation pragmas
       [not found] <877cwg1b0n.fsf.ref@aol.com>
@ 2023-02-17 17:01 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; only message in thread
From: Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-02-17 17:01 UTC (permalink / raw)
  To: 61578

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






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-17 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <877cwg1b0n.fsf.ref@aol.com>
2023-02-17 17:01 ` bug#61578: 30.0.50; c-ts-mode feature request intendation pragmas Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).