Is it possible to setup emacs to indent C code, with tabs for blocks { ... } and spaces with other wrapping (argument, for example)?


<-->if (foo) {
<--><-->function(a, b,
<--><-->.........c, d);

Currently emacs uses tabs with spaces for padding.

<-->if (foo) {
<--><-->function(a, b,
<--><--><--><-->.c, d);

(where <--> is for tabs and . for spaces).

QtCreator has the option to: Align continuation lines --> with spaces.

Is this possible in emacs?

Update, I wasn't aware at time of asking but this is sometimes called "smart-tabs".

  • 1
    This is more commonly known as "Smart Tabs", there's at least one Emacs package out there for it.
    – wasamasa
    Mar 11, 2017 at 10:13


Browse other questions tagged or ask your own question.