[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I get rid of control-M characters?

From: Martin Gustavsson
Subject: How do I get rid of control-M characters?
Date: Mon, 23 Oct 2000 13:37:58 +0200 (MET DST)

I am using GNU Emacs 20.3.1 for Sun Solaris 2.5.1 at work and
version 20.7 for Microsoft Windows at home. I sometimes have
to deal with files where every line ends with a control-M
character and I think this is quite annoying. One problem which
have occured is that a LaTeX file can not be processed since a
\newcommand line ends with a control-M character. Another problem
is that a shell-script did not work since every line ended with a
control-M character. I am quite sure that Emacs is not
responsible for the first problem, but that knowledge does not
solve the problem.

I do not know if this is correct, but I think that a change from
version 19 to 20 is that Emacs interprets a file with control-M
characters as a MS-DOS or Microsoft Windows file and tries to not
change this. Please correect me if I am wong.

I would like to know the following:

1) how to know if there are control-M characters present?

2) how to get rid of these control-M characters?

I have tried to work around this by myself. The GNU Emacs Manual
( gives
the following possible addition to a .emacs file:

  (add-hook 'comint-output-filter-functions

The Emacs FAQ for the Microsoft Windows port
( gives
the following possible addition to a .emacs file:

  (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)

(In both cases is this connected with "ctrl-m's printed in the shell

But I have solved my problems with these both additions. Please let 
me know how to do. (I know one possible solution and that is to check
the file with vi and then use the dos2unix command, but I hope that
there is a soultion where one can solely use Emacs.)

Best regards

Martin Gustavsson

 Martin G. H. Gustavsson
 Fysik och teknisk fysik       tel.      +46 31 772 3215
 Goeteborgs universitet &      fax.      +46 31 772 3496
 Chalmers tekniska hoegskola   e-mail:
 SE-412 96 GOETEBORG           WWW:
 SWEDEN                        location: Forskarhuset, room 6319

 WWW for the Atomic Physics Group:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]