<分区>
我不完全确定这个问题是属于 stackoverflow 还是 super 用户(是否有 emacs 堆栈交换?)。根据 meta.stackoverflow 帖子,我假设它确实如此。
我的 emacs 默认头文件(.h 类)为 c 模式。我可以轻松地键入 M-x c++-mode 并恢复突出显示,但因为我用 c++ 编程比用 c 编程更频繁。我想知道我需要更改什么才能将 .h 添加到 c++ 组。
<分区>
我不完全确定这个问题是属于 stackoverflow 还是 super 用户(是否有 emacs 堆栈交换?)。根据 meta.stackoverflow 帖子,我假设它确实如此。
我的 emacs 默认头文件(.h 类)为 c 模式。我可以轻松地键入 M-x c++-mode 并恢复突出显示,但因为我用 c++ 编程比用 c 编程更频繁。我想知道我需要更改什么才能将 .h 添加到 c++ 组。
最佳答案
这是我的 .emacs 文件中的内容:
; Make .h files be C++ mode
(setq auto-mode-alist(cons '("\\.h$" . c++-mode) auto-mode-alist))
可能有更简单的方法,但这很有效。
关于c++ - 在 emacs 中将 .h 设置为 c++ 模式组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3606113/