views:

123

answers:

2

Hi Guys,

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

Cheers,

+2  A: 

At least with emacs 22.3 this seems to be an issue only if your file has a combination of newline styles, say from editing with a "non-enlightened" editor under both windows unix.

If the lines are consistently terminated w/ ^M modern emacs will note at the bottom that it's [dos] mode and not show the ^M. It's then smart enough to place ^M in the file when you save.

If you've got some odd combination you can try running

$ unix2dos FILE

to get to a good state, after which hopefully you can keep it in DOS mode.

I note that my xemacs 21.4 doesn't have this feature, alas.

There's a discussion here: http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/676113e90825d4e7

Paul Rubel
unix2dos changes the file, which is not what the OP wants
Peter Miehle
right but... the suggestion to consider unix2dos was offered as a way to correct the problem where a file contains mixed newlines. In other words, the answer provided here applies to a question the OP *may not have known to ask*.
Cheeso
+7  A: 

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