即使在更改.emacs之后,Emacs也会自动添加换行符

Jay*_*son 12 emacs text-editor

我目前在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.
 )
Run Code Online (Sandbox Code Playgroud)

Tre*_*son 15

你有没有尝试过:

(setq mode-require-final-newline nil)
Run Code Online (Sandbox Code Playgroud)

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

如何找出使用它的模式而不是你尝试的变量并不是很明显,但可能是那种模式的作者更了解...

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