Mailing List Archive


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

Re: [tlug] line ending in XEmacs



>>>>> "SY" == Shimpei Yamashita <shimpei@example.com> writes:

    SY> Very basic question, I'm sure, but I can't find the answer in
    SY> the FAQ or the manual.

    SY> I recently had to edit a text file with MS-DOS line endings in
    SY> XEmacs, and was a bit disappointed to see that XEmacs doesn't
    SY> seem to auto-detect line endings. I've used Mule versions that
    SY> do detect line endings, so I'm sure I just need to set a
    SY> variable or something, but which one?

    SY> As for the actual file, I ended up stripping \r and restoring
    SY> it afterwards with perl one-liners. Inelegant, yes, but I was
    SY> in a big hurry.

I just did a small experiment in emacs (21.2.1). I opened a new file
and typed two lines, then added ^M (by typing ^q^m) in the end of the
first. Saved the file and opened it again. UNIX encoding and ^M in the
end of the first line. Then I added ^M in the end of the second line
so that every line in the file has DOS line ending. Reopened the
file. DOS in the mode line and no ^M visible.

So, my guess is that you have to have _all_ lines to end with ^M to
make emacs decide it is a DOS file.

Also, you can force coding system to be dos by typing "^x RET c dos"
before opening the file. To add missing ^M do "^x RET f dos" and save
the file. To convert open buffer to UNIX encoding do "^x RET f unix".

Xemacs may differ though...

Viktor


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links