如何解决编写 cpp 时,Emacs 默认缩进和 clang-format 的冲突

自定义 emacs 的缩进配置,适配 clang-format

cc-mode 的配置方法可以参考 我想了解下, emacs 下的缩进到底是怎么设置的...?😥 - #7,来自 xhcoding

emacs 31 下 c+±ts-mode 的配置缩进的方法:

    (treesit-simple-indent-add-rules 'cpp
                                     '(
                                       ((n-p-gp nil nil "namespace_definition") grand-parent 0) ;; 命名空间不缩进
                                       )
                                     :before
                                     'c-ts-common-baseline-indent-rule
                                     )
1 个赞