all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* c indent when a function has other attributes
@ 2025-01-08 14:47 Luca Ferrari
  2025-01-19 11:04 ` Joel Reicher
  0 siblings, 1 reply; 2+ messages in thread
From: Luca Ferrari @ 2025-01-08 14:47 UTC (permalink / raw)
  To: help-gnu-emacs

Hi al,
I'm having this problem with c-mode and C-M-\ (withour any regard to
the c-style): when a function declaration has an __alignment__ gcc
macro Emacs seems to screw up all indentation.
For example:

static void foo(char *bar) __attribute__((noreturn));
static void bar();

when I indent the code I end up with something like:

static void foo(char *bar) __attribute__((noreturn));

static void bar();

where the lines following the __attribute__ macro are all screwed up.
Is there a way to instrument Emacs to "indent" by means of the semicolon?

Thanks,
Luca



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c indent when a function has other attributes
  2025-01-08 14:47 c indent when a function has other attributes Luca Ferrari
@ 2025-01-19 11:04 ` Joel Reicher
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Reicher @ 2025-01-19 11:04 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: help-gnu-emacs

Luca Ferrari <fluca1978@gmail.com> writes:

> I'm having this problem with c-mode and C-M-\ (withour any 
> regard to the c-style): when a function declaration has an 
> __alignment__ gcc macro Emacs seems to screw up all indentation.
> For example:

[...]

> where the lines following the __attribute__ macro are all 
> screwed up.
> Is there a way to instrument Emacs to "indent" by means of the 
> semicolon?

Full disclosure: I didn't look through the details of your 
example, but have you tried using treesitter? To a certain extent 
problems with indentation (and font lock) with the non-treesitter 
code is "inevitable".

I had exactly the same happen with some of my Java code, and it 
was easier to switch to treesitter than figure out why it was 
happening.

Regards,

        - Joel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-19 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08 14:47 c indent when a function has other attributes Luca Ferrari
2025-01-19 11:04 ` Joel Reicher

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.