Atom Messes Up Formatting In Emacs File

0

I used the scp command to copy a file from a remote Linux computer to my local Linux computer (this file was edited using Emacs on that remote computer). I tried to open the file in Atom on my local computer, and the formatting and new lines did not preserve. I'm not sure how to come up with a fix for this.

Sample of code when opened in Emacs
Sample of code when opened in Atom

olsons

Posted 2019-04-07T15:37:14.377

Reputation: 3

Answers

0

I think this is not atom "messing up" the formatting, but that atom does not recognize mac line endings. The emacs image hints that you have mac line endings (notice the -UU-(MAC) thing on the status line. Atom seems to ignore the mac line endings (0d), probably expecting the unix ones. I don't know atom well enough but you can convert it to unix (0a) line ending on emacs with

C-x
RET
f
utf-8-unix

You may choose another encoding besides utf-8 if you wish.

I am sure there are also atom-specific approach, just search for "atom mac line endings"

Ott Toomet

Posted 2019-04-07T15:37:14.377

Reputation: 116

This is perfect, the code provided for emacs works, I'm yet to find an atom-specific fix, but thank you for the help! – olsons – 2019-04-08T01:16:47.063

0

Atom may not recognise the line endings. UNIX uses an LF character, macOS uses a single LF character, and older mac operating systems may use a single CR character for new lines. You can switch between them at the bottom right corner of the atom text editor next to the encoding and syntax selection.

Tyler

Posted 2019-04-07T15:37:14.377

Reputation: 74