多年来,我一直在我的.emacs.el
文件中使用这些功能:
(defun dos2unix ()
"Convert a DOS formatted text buffer to UNIX format"
(interactive)
(set-buffer-file-coding-system 'undecided-unix nil))
(defun unix2dos ()
"Convert a UNIX formatted text buffer to DOS format"
(interactive)
(set-buffer-file-coding-system 'undecided-dos nil))
这些函数使我能够轻松地在格式之间切换,但我不确定如何配置Emacs以默认使用一种特定的格式,而不管我正在使用哪个平台。目前情况是,当我在Windows上运行时,Emacs会保存为Windows格式;当我在UNIX / Linux上运行时,Emacs会保存为UNIX格式。我想指示Emacs始终以UNIX格式编写,无论我在哪个平台上运行。我该怎么做?
我应该添加一些文本模式钩子,调用其中一个函数吗?例如,如果我在Windows上,则在找到文本文件时调用dos2unix?
default-buffer-file-coding-system
是什么?我在Emacs 27.2中似乎找不到它。 - jdhao