all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* C-mode: how to ignore certain tokens (sometimes)
@ 2014-12-26 20:40 Óscar Fuentes
  0 siblings, 0 replies; 3+ messages in thread
From: Óscar Fuentes @ 2014-12-26 20:40 UTC (permalink / raw)
  To: help-gnu-emacs

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?




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

* Re: C-mode: how to ignore certain tokens (sometimes)
       [not found] <mailman.16744.1419626453.1147.help-gnu-emacs@gnu.org>
@ 2014-12-29 18:21 ` Alan Mackenzie
  2014-12-29 23:44   ` Óscar Fuentes
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2014-12-29 18:21 UTC (permalink / raw)
  To: help-gnu-emacs

Hello, ?scar.
?scar Fuentes <ofv@wanadoo.es> wrote:
> 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?

Not at the moment, no.  I have a half-tested enhancement "noise macros"
to CC Mode, a bit like the existing "macros with semicolons", designed to
address precisely this problem.  I foresee releasing it early in 2015.

Have a happy New Year!

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: C-mode: how to ignore certain tokens (sometimes)
  2014-12-29 18:21 ` Alan Mackenzie
@ 2014-12-29 23:44   ` Óscar Fuentes
  0 siblings, 0 replies; 3+ messages in thread
From: Óscar Fuentes @ 2014-12-29 23:44 UTC (permalink / raw)
  To: help-gnu-emacs

Alan Mackenzie <acm@muc.de> writes:

>> It there a way to tell C-mode that certain tokens should be ignored
>> while doing the analysis required by the indentation engine?
>
> Not at the moment, no.  I have a half-tested enhancement "noise macros"
> to CC Mode, a bit like the existing "macros with semicolons", designed to
> address precisely this problem.  I foresee releasing it early in 2015.

Great! Let me know if you need a tester. (I looked into the CC-Mode hg
repo at SF but it is not obvious from the branches' names which one
implements the feature.)

Since you addressed the issue here, please disregard the CC-mode bug
with the same topic that I submitted a few days ago, if you wish.

> Have a happy New Year!

Thanks. Have a happy New Year you too.




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

end of thread, other threads:[~2014-12-29 23:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 20:40 C-mode: how to ignore certain tokens (sometimes) Óscar Fuentes
     [not found] <mailman.16744.1419626453.1147.help-gnu-emacs@gnu.org>
2014-12-29 18:21 ` Alan Mackenzie
2014-12-29 23:44   ` Óscar Fuentes

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.