Hiding ^M in emacs

后端 未结 12 823
陌清茗
陌清茗 2020-12-12 12:54

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

12条回答
  •  粉色の甜心
    2020-12-12 13:34

    If you'd like to view the log files and simply hide the ^M's rather than actually replace them you can use Drew Adam's highlight extension to do so.

    You can either write elisp code or make a keyboard macro to do the following

    select the whole buffer
    hlt-highlight-regexp-region
    C-q C-M
    hlt-hide-default-face
    

    This will first highlight the ^M's and then hide them. If you want them back use `hlt-show-default-face'

提交回复
热议问题