15

我目前在 Mac 上,并试图将 Emacs 设置为默认情况下不在文件末尾添加换行符,但我搜索的几乎所有内容都说只需将 (setq require-final-newline nil) 添加到 .主目录中的 emacs 文件...这不起作用。接下来我应该看什么来改变?

这就是 .emacs 文件现在的样子

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(gud-gdb-command-name "gdb --annotate=1")
 '(large-file-warning-threshold nil)
 '(require-final-newline nil))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )
4

1 回答 1

18

你有没有尝试过:

(setq mode-require-final-newline nil)

文件的主要模式可能是使用此变量的值...

如何找出哪些模式使用 this 而不是您尝试的变量并不是很明显,但大概该模式的作者更清楚......

因此,您可能想要更改该文件的主要模式,这可以通过回答这个 SQ 问题来完成:如何告诉 emacs 在 C++ 模式下打开 .h 文件?(显然根据您的需要定制答案)。

于 2012-11-26T23:43:26.723 回答