Re: ^M problem

"Stephen J. Turnbull" <[email protected]> Sat, 05 Nov 2005 14:42:02 +0900
Newsgroups gmane.emacs.xemacs.general
Organization The XEmacs Project
Message-ID <[email protected]>
>>>>> "matthew" == matthew miner <[email protected]> writes:

    matthew> ^M is most likely because you have a file that is a
    matthew> DOS/Windows file, but is being treated as a Unix file.

21.4 w/o Mule does not autodetect line endings by default (in fact, I
don't think the default configuration w/o Mule includes that facility
at all).  This was a deliberate decision, based on the number of Unix
people working in environments where DOS files are not allowed or are
not processed correctly by other software.

You need an XEmacs configured --with-file-coding (or --with-mule).
You may need to switch it on in the former case.

    matthew> I would dearly like to know of a way of forcing UNIX or
    matthew> DOS mode, but I don't think there is.

Due to ancient lossage in Mule design, it's clumsy.  You need to kill
the buffer and reread with C-u C-x C-f filename RET undecided-unix RET.

The reason this is necessary is that if a DOS file is read in DOS
mode, the CRLF in the file is converted to LF in the buffer.  So there
is no way to determine what the file contained without looking at the
file.

    matthew> I have found it useful to track down the cause of the ^M
    matthew> presentation by bisecting the file and reloading:

C-u C-s [ ^ C-q C-m ] C-q C-j

is what I'd try.  (Yes, you can isearch regexps.)


-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.