【问题标题】:Emacs C++ mode Constructor initialize incorrect indentEmacs C++模式构造函数初始化不正确的缩进
【发布时间】:2015-08-20 08:10:17
【问题描述】:

我的emacs默认缩进是这样的:

FileChannel::FileChannel(const std::string &file_path) :
file_path_(file_path), fd_(0)
{  
}

但我想要这样:

FileChannel::FileChannel(const std::string &file_path) :
    file_path_(file_path), fd_(0)
{  
}

或:

FileChannel::FileChannel(const std::string &file_path)
    : file_path_(file_path), fd_(0)
{  
}

我应该如何更改我的配置?

【问题讨论】:

  • 我想你可以通过google-c-style 包获得后者。

标签: emacs emacs24


【解决方案1】:

您可以将其添加到您的 .emacs 中:

(defun my-c-c++-mode-init ()
  (setq c-basic-offset 4)
  (c-set-offset 'member-init-intro '+))

(add-hook 'c-mode-common-hook 'my-c-c++-mode-init)

【讨论】:

    猜你喜欢
    • 2010-10-14
    • 1970-01-01
    • 2020-05-11
    • 2018-06-30
    • 1970-01-01
    • 2021-06-30
    • 2021-05-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多