在 emacs 中隐藏 ^M [英] Hiding ^M in emacs

查看:25
本文介绍了在 emacs 中隐藏 ^M的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我需要读取行尾包含 ^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-style 或 dos-style 行尾编码似乎没有太大区别(但 unix-style 是我的默认设置).我正在使用未决定的(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 []))

Johan Bockgård 的解决方案.我找到了 这里.

Solution by Johan Bockgård. I found it here.

这篇关于在 emacs 中隐藏 ^M的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆