在emacs中隐藏^ M [英] Hiding ^M in emacs
问题描述
有时我需要在行尾读取具有^ M(control-M)的日志文件。我可以做一个全局的替换来摆脱它们,但是更多的东西被记录到日志文件中,当然,它们都会回来。
Sometimes I need to read log files that have ^M (control-M) in the line endings. I can do a global replace to get rid of them, but then something more is logged to the log file and, of course, they all come back.
设置unix-样式或dos类型的行尾编码似乎没有太大的区别(但是unix样式是我的默认值)。我正在使用未定义的(unix | dos)编码系统。
Setting unix-style or dos-style end-of-line encoding doesn't seem to make much difference (but unix-style is my default). I'm using the undecided-(unix|dos) coding system.
我在Windows上,读取log4net创建的日志文件(尽管log4net显然不是只有这个烦恼的来源)。
I'm on windows, reading log files created by log4net (although log4net obviously isn't the only source of this annoyance).
任何提示?
推荐答案
(defun remove-dos-eol ()
"Do not show ^M in files containing mixed UNIX and DOS line endings."
(interactive)
(setq buffer-display-table (make-display-table))
(aset buffer-display-table ?\^M []))
JohanBockgård的解决方案我发现它这里。
Solution by Johan Bockgård. I found it here.
这篇关于在emacs中隐藏^ M的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!