Re: some printed ^M line ending text in Emacs after editing with Meld



Esteemed Meld devs & users,

Good news: Meld doens't appear to be responsible for ^M appearing.

FYI my steps to eliminating Meld (reposted from SO):
http://stackoverflow.com/questions/13799631/why-is-m-being-added-to-a-script-r-after-modifying-with-meld/13879162#13879162

Apologies for any action taken on this non-Meld issue,

Karl

In a terminal i ran 'cat script.r | hexdump -C | head' and found a '0d 0a' in the file, which is DOS formatting for a new line (carriage return 0d immediately followed by a line feed 0a). I ran the same command on another_script.r i was merging with but only observed '0a', no '0d 0a', indicating Unix formatting.

To check further if this was the source of the ^M line endings, script.r was converted to unix formatting via dos2unix script.r & verified that '0d 0a' was converted to '0a' using hexdump -C as above. I performed a merge using Meld in attempting to replicate the process which yielded ^M line endings in my script's. I reoppened both files in Emacs/ESS and found no ^M line endings. Short of converting script.r back to dos formatting and repeating the above procedure to see if the ^M line endings re-appear, i believe i've solved my ^M issue, which simply is that, unbeknownst to me, one of my files was dos formatted. My take home message: in a Windows dominated environ, never assume that one's personal linux environment doesn't contain DOS bits. Or line endings.

On 12/12/12 16:50, Karl Brand wrote:
Esteemed Meld devs & users,

What i do:

1. Create a script.r using Emacs/ESS.
2. Make some modifications to script.r by pulling some lines of code
from another_script.r
3. Reopen script.r in Emacs/ESS to continue working.

All the lines in another_script.r which were *not* pushed to script.r
end with ^M

Some times it's the other way around - only the line that was
pushed/pulled ends with ^M's. So far i haven't isolated exactly which
action determines where the ^M's are placed. Either way i still end up
with ^M's all over the place and i'd like to avoid getting them after
using Meld!

FWIW:
-all actions are performed under Linux (Ubunt 12.04)
-the directory is being synced by dropbox
-in Meld, Preferences > Encoding tab, "utf8" is entered in the text box.

Current work around is running in a terminal: dos2unix /path/to/script.r
which strips the ^M's

But this shouldn't be necessary and I'm hoping some one here can tell me
how to avoid these.

With thanks,

Karl

(re)posted here as suggested off topic at SO:
http://stackoverflow.com/questions/13799631/create-script-r-in-emacs-modify-with-meld-git-commit-reopen-in-emacs-m



--
Karl Brand
Dept of Cardiology and Dept of Bioinformatics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
T +31 (0)10 703 2460 |M +31 (0)642 777 268 |F +31 (0)10 704 4161


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