all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Customizing C-mode indentation
@ 2016-10-19 18:42 John Mastro
  0 siblings, 0 replies; only message in thread
From: John Mastro @ 2016-10-19 18:42 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-19 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-19 18:42 Customizing C-mode indentation John Mastro

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.