不要使用emacs显示^ M个字符

Chm*_*nah 11 unix windows emacs newline character-encoding

我想知道是否有办法暂时不在文件中显示^ M个字符.我不想删除它们我只是想不显示它们.

干杯,

Ott*_*fer 12

我使用以下功能(忘记我发现的地方):

(defun hide-ctrl-M ()
  "Hides the disturbing '^M' showing up in files containing mixed UNIX and DOS line endings."
  (interactive)
  (setq buffer-display-table (make-display-table))
  (aset buffer-display-table ?\^M []))
Run Code Online (Sandbox Code Playgroud)


acu*_*ich 7

GNU Emacs的文档描述了如何使用处理文本编码revert-buffer-with-coding-system:

C-x <RET> r coding <RET>
Revisit the current file using the coding system coding (revert-buffer-with-coding-system).
Run Code Online (Sandbox Code Playgroud)

在您的情况下,如果未自动检测到正确的系统编码,您可以键入:

C-x RET r dos RET

避免在^M没有实际修改文件的情况下显示字符.