jcsalomon / smarttabs

Emacs smart tabs - indent with tabs, align with spaces!
http://www.emacswiki.org/emacs/SmartTabs
114 stars 20 forks source link

[BUG]: smarttabs will disable c-backslashes to align using TAB #34

Open c02y opened 9 years ago

c02y commented 9 years ago

smarttabs will disable the c-backslashes to align using TAB or indent-region,

Say I got a snippet:

#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen)              \
    do {                                                    \
        unsigned _klen = fieldlen;                          \
        write(HASH_EMIT_KEYS, &_klen, sizeof(_klen));       \
        write(HASH_EMIT_KEYS, keyptr, fieldlen);            \
    } while (0)

If you're not using smarttabs, the backslashes will be aligned which is default after TAB or indent-region, but if you use smarttabs, it will become this:

#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen)  \
    do { \
        unsigned _klen = fieldlen; \
        write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \
        write(HASH_EMIT_KEYS, keyptr, fieldlen); \
    } while (0)

the backslashes will not be aligned after TAB or indent-region, even you set the c-auto-align-backslashes, c-backslash-column and c-backslash-max-column according to GNU Macro-backslashes page, they won't work.

This problem took me hours to find out that it is caused by the smarttabs package. I even posted a question(already deleted after I found the reason) in emacs.stackexchange.com.

jimparis commented 3 years ago

If you disable smart-tabs-mode, then use indent-region to fix the backslashes, the right leading tabs and spaces created by smart-tabs-mode seem to still be there. So that's at least a partial workaround.