且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Emacs C++ 模式缩进不正确?

更新时间:2022-11-08 13:23:08

我的 .emacs 文件中有以下内容:

I have the following in my .emacs file:

(defun my-c++-mode-hook ()
  (setq c-basic-offset 4)
  (c-set-offset 'substatement-open 0))
(add-hook 'c++-mode-hook 'my-c++-mode-hook)

您可以通过在任何行上按 [ctrl-c ctrl-s] 来确定要编辑的偏移量.在 if 后面带大括号的第一行,它会说 substatement-open.

You can determine which offset to edit by hitting [ctrl-c ctrl-s] on any line. On the first line with a brace after the if it will say substatement-open.