zinking
zinking

Reputation: 5695

make emacs don't change the line end automatically

it's not about using the windows style line end. I would prefer the unix style. but I don't want emacs to change those windows line ends there for me. it is sometimes annoying for the automatic change

how to do that ?

Upvotes: 0

Views: 1499

Answers (1)

phils
phils

Reputation: 73345

Emacs does not change the EOL characters automatically. By default it detects and uses the existing EOL characters in the file.

Emacs recognizes which kind of end-of-line conversion to use based on the contents of the file: if it sees only carriage-returns, or only carriage-return linefeed sequences, then it chooses the end-of-line conversion accordingly. You can inhibit the automatic use of end-of-line conversion by setting the variable `inhibit-eol-conversion'to non-`nil'. If you do that, DOS-style files will be displayed with the `^M' characters visible in the buffer; some people prefer this to the more subtle `(DOS)' end-of-line type indication near the left edge of the mode line (*note eol-mnemonic: Mode Line.).

C-hig (emacs) Recognize Coding RET

The current EOL encoding is indicated at the left-hand side of the mode line:

The character after CS is usually a colon. If a different string is displayed, that indicates a nontrivial end-of-line convention for encoding a file. Usually, lines of text are separated by "newline characters" in a file, but two other conventions are sometimes used. The MS-DOS convention uses a "carriage-return" character followed by a "linefeed" character; when editing such files, the colon changes to either a backslash (`\') or `(DOS)', depending on the operating system. Another convention, employed by older Macintosh systems, uses a "carriage-return" character instead of a newline; when editing such files, the colon changes to either a forward slash (`/') or `(Mac)'. On some systems, Emacs displays `(Unix)' instead of the colon for files that use newline as the line separator.

C-hig (emacs) Mode Line RET

Start Emacs with emacs -Q to check its default behaviour.

Upvotes: 3

Related Questions