A continuación aparece una instantánea de la página web tal y como aparecía en 19/5/2024 (la última vez que nuestro rastreador la visitó). Esta es la versión de la página que se usó para la clasificación de los resultados de búsqueda. Puede que la página haya cambiado desde la última vez que la guardamos en caché. Para ver lo que puede haber cambiado (sin la información destacada), ve a la página actual.
Bing no se hace responsable del contenido de esta página.
Emacs rewrites line endings on save (Windows) - Emacs - System Crafters
System Crafters
Does anyone know why Emacs changes line endings when saving a file? I’m working on Windows and it overrides LF with CRLF every time, which is very annoying when writing bash scripts, as well when committing stuff in Git (diffs are huge).
I googled a lot, tried to copy Doom’s settings, but it still overrides unix configs I have from LF to CRLF. I also checked Crafted Emacs’ code, but it’s basically the same as Doom’s in regard to the coding system config.
Overall, my config is almost at the point of being good for my use cases, but this is a major show stopper for me.
It might have more to do with git than emacs. Git provides auto.crlf to checkout with CR+LF and commit back with LF. This Github doc does a decent job of explaining it. Hope that works!
Thanks @shom, I’ll check out my git settings, I believe Git install set it to CR+LF by default.
However, it seems Emacs does this outside a Git repo folder. For example, I moved a config file to Desktop, converted line endings to LF, added a new line in Emacs, and saved the buffer – the whole file has been converted to CRLF after save.
I just want Emacs to behave like other text editors, I’m even fine if it introduces mixed line endings, but overriding the whole file is pretty bad for me.
Is the above line the only thing you have in your config or do you have your previous lines as well?
Might be worth trying to launch emacs with just this specific config to isolate the issue: