.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))
Run Code Online (Sandbox Code Playgroud)
这些函数允许我轻松地在格式之间切换,但我不知道如何配置Emacs默认情况下以一种特定格式写入,无论我使用哪个平台.就像现在一样,当我在Windows上运行时,Emacs以Windows格式保存; 当我在UNIX/Linux中运行时,Emacs以UNIX格式保存.
无论我运行的平台如何,我都想指示Emacs以UNIX格式编写.我该怎么做呢?
我是否应该添加一些调用这些函数之一的文本模式钩子?例如,如果我在Windows上,那么dos2unix在找到文本文件时调用?