unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: help-gnu-emacs@gnu.org
Subject: C-mode: how to ignore certain tokens (sometimes)
Date: Fri, 26 Dec 2014 21:40:32 +0100	[thread overview]
Message-ID: <871tnm9mbj.fsf@wanadoo.es> (raw)

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	other threads:[~2014-12-26 20:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-26 20:40 Óscar Fuentes [this message]
     [not found] <mailman.16744.1419626453.1147.help-gnu-emacs@gnu.org>
2014-12-29 18:21 ` C-mode: how to ignore certain tokens (sometimes) Alan Mackenzie
2014-12-29 23:44   ` Óscar Fuentes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871tnm9mbj.fsf@wanadoo.es \
    --to=ofv@wanadoo.es \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).