Wednesday, October 26, 2022

[SOLVED] Don't display ^M characters with emacs

Issue

I am wondering if there is a way to temporarily not display the ^M characters in a file.
I don't want to remove them I just want to not display them.

id='dv3'>

Solution

I use the following function (forgot where I found it):

(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 []))


Answered By - Otto Pichlhoefer
Answer Checked By - Dawn Plyler (WPSolving Volunteer)