[ESS] Replace control characters in log

Mathieu Basille basille at biomserv.univ-lyon1.fr
Tue Jan 15 18:07:31 CET 2008


Maybe this could help. I have this in my .emacs:

;; M-x dos2unix
(defun dos-unix ()
(interactive)
(goto-char (point-min))
(while (search-forward "\r" nil t) (replace-match "")))

Then the command 'M-x dos2unix' just get rid of all ^M.
I also have the opposite function, for the reverse use:

;; M-x unix2dos
(defun unix-dos ()
(interactive)
(goto-char (point-min))
(while (search-forward "\n" nil t) (replace-match "\r\n")))

This will not tell you why it happens (see Richard's answer for this) 
but should help you to remove all ^M.

Mathieu.



Will a écrit :
> Dear ESS list,
> 
> it might sound strange but I am using GNU Emacs/ESS with SAS in a MS 
> Windows XP environment in Batch mode. I have the problem that in the log 
> window strange control characters appear ("^M") which mess up the layout.
> 
> How do I tell Emacs to replace those control characters with the correct 
> formatting?
> 
> Thanks in advance,
> 
> Will


-- 

¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
                                                 ]
  Mathieu BASILLE -- PhD Student                 ]
                                                 ]
  Laboratoire de Biométrie et Biologie Évolutive ]
  Université Claude Bernard Lyon 1 - France      ]
   http://lbbe.univ-lyon1.fr/                    ]
                                                 ]
  My resume:                                     ]
   http://mathieu.basille.net/pro/               ]
  Habitat web-site:                              ]
   http://biomserv.univ-lyon1.fr/spip_habitat/   ]
________________________________________________]




More information about the ESS-help mailing list