我希望 emacs 像这样缩进我的 c/c++ 代码:
auto LoopMatcher = forStmt(hasLoopInit(declStmt(hasSingleDecl(varDecl(
hasInitializer(integerLiteral(equals(0)))))))).bind("forLoop");
(代码取自 clang 的 AST 匹配器教程)。
换句话说,我希望 emacs 在一个或多个左括号后按默认偏移量缩进。
最佳答案
这里有一个解决方案:
(defun custom-indent (langelem)
(save-excursion
(goto-char (cdr langelem))
(vector (+ (current-column) c-basic-offset))))
(c-add-style "custom" '((c-offsets-alist . ((arglist-intro . custom-indent)))))
(c-set-style "custom")
关于emacs - 缩进深度嵌套的函数调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23740024/