开发者

Indent openmp directives as C/C++ code in emacs

In a previous question, I learned how to indent macros as regular C code on emacs. I just need this b开发者_JAVA百科ecause of #pragma omp directives from OpenMP, but I'd like to maintain all other kind of macros, like #if and #endif, indented as the default.

(c-set-offset (quote cpp-macro) 0 nil)

The rule above treats all macros as the same. My question is: Is there a way to specialize this rule?


If you look at M-x describe-variable c-offsets-alist, which defines a list of variables that represent the syntactic constructs of the various programming languages, you'd only see cpp-macro and cpp-macro-cont which represent macros and continuing macros respectively. The list does not tell between #pragma and say, #if.

So, there is no direct way that Emacs provides to tell #pragma from other directives.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜