help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C-mode: how to ignore certain tokens (sometimes)


From: Óscar Fuentes
Subject: C-mode: how to ignore certain tokens (sometimes)
Date: Fri, 26 Dec 2014 21:40:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

One common idiom in C++ is

class DECORATION foo {
...

where DECORATION acts as an attribute to be applied to the class being
defined. One example is __dllexport (Windows) or __attribute__
((visibility("default"))) (GNU/Linux). Usually it is a macro that
expands to some compiler/platform-specific decoration.

The problem is that the presence of DECORATION confuses C-mode and it
makes bad guesses of some of the elements. For instance:

struct EXPORT foo {
public:
  foo(int d)
    : data()
    {}

The colon that precedes `data' is interpreted as `statement-cont' when
it should be `member-init-intro'.

It there a way to tell C-mode that certain tokens should be ignored
while doing the analysis required by the indentation engine?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]