From: John Mastro <john.b.mastro@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Customizing C-mode indentation
Date: Wed, 19 Oct 2016 11:42:26 -0700 [thread overview]
Message-ID: <CAOj2CQTr2gdMhECjjyABnWh-S6fR2qRR4+L9ATXGL8+6=_bgCA@mail.gmail.com> (raw)
Hello Emacsers,
I have a question about customizing c-mode's indention, specifically
regarding teaching c-mode about loop macros. I have some C code that
defines a preprocessor macro like:
#define iter_each(iter, v) (void * v; iter_next((iter), v); )
An example use would be:
struct iter it;
iter_init(&it, data);
for iter_each(&it, p) {
/* ... */
}
However, because the `iter_each' hides the fact that this is a `for'
loop, c-mode indents it like this:
for iter_each(&it, p) {
/* ... */
}
What's the best way to teach c-mode the correct way to indent this
construct? So far what I've found is `c-special-indent-hook', which
works, but I'm wondering if there's a better way I haven't found (e.g.
by customizing a regexp, which would be easier to stick in a
.dir-locals.el).
Thanks
John
reply other threads:[~2016-10-19 18:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOj2CQTr2gdMhECjjyABnWh-S6fR2qRR4+L9ATXGL8+6=_bgCA@mail.gmail.com' \
--to=john.b.mastro@gmail.com \
--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.
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.