Emacs的使用C宏后缩进 [英] Emacs indenting after macro in C
本文介绍了Emacs的使用C宏后缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#define INIT_MACRO create(); some(); enviroment();
...
void function(){
INIT_MACRO
extra_indented();
normal_indented();
}
如何让emacs的正确处理与当它被要求自动缩进上述情况?
how do i make emacs deal correctly with the above situation when it is requested to automatically indent?
编辑我看到的唯一解决方法是告诉Emacs的治疗只含有帽线,下划线和空格,如果他们有在最后一个分号......但我怎么做呢?
EDIT the only solution i see is to tell emacs to treat lines containing only caps, underscores and spaces as if they have a semicolon at the end... but how would i do that?
推荐答案
这个作品:
#define INIT_MACRO do { create(); some(); enviroment(); } while (0)
...
void function(){
INIT_MACRO;
extra_indented();
normal_indented();
}
它通常是更好,当你要用就用这种伎俩来避免问题:
It is usually better to use this trick to avoid problems when you use:
if (...)
MACRO();
else
...
和每行分号更容易在我看来,阅读。
and a semicolon on each line is easier to read in my opinion.
这篇关于Emacs的使用C宏后缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文