c++ - Emacs 缩进模板类/函数

标签 c++ templates emacs

有人知道如何禁止 emacs 在模板子句后缩进函数或类的名称吗?

目前的结果是:

template <typename T>
    class A {
    /* ... */
    };

我想要的地方:

template <typename T>
class A {
/* ... */
};

非常感谢您的帮助。

编辑 1 我正在使用带有 java 的 c++ 模式作为 c++ 的缩进样式。我以这种方式自定义了 c-offset-alist:

(custom-set-variables 
;;
'(c-offsets-alist (quote ((case-label . +) (innamespace . 0))))

最佳答案

转到 class 行并按 TAB 执行(主动)缩进。
然后按Control-CControl-O显示topmost-intro-cont`

的缩进模式

ENTER,然后您可以更改缩进数(例如 3 到 0)。

.emacs 的末尾,您可以永久设置该指令:

  (c-set-offset 'topmost-intro-cont 0 nil)

关于c++ - Emacs 缩进模板类/函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4265022/

相关文章:

c++ - 有没有办法缩短这个while条件?

C++ getline() 读取文件行无限循环遍历文件

emacs - 在终端中使用 emacs 时某些键绑定(bind)不起作用

c++ - 使用给定类对类模板进行特化

emacs - "Wrong type argument: stringp, cons"在串联列表上调用 apply 函数时

date - 时间戳的emacs org-mode语言

c++ - 如何拥有在当前类之后定义的类的变量?

c# - PInvoke:返回的 double 组有问题吗?

c++ - std::is_base_of 和 std::is_convertible 之间的区别

C++ 关于函数模板