reddit / emacs

Disabling auto identation when saving a file

FourOmegaman · 2022-02-03 14:27
I'm using Doom Emacs (pretty much vanilla with a few packages) and whenever I save a file, Emacs automatically changes the indentation. For example, if I'm editing a C++ file like this: application icoFoam; startFrom startTime; startTime 0; stopAt endTime; endTime 20; deltaT 0.05; writeControl runTime; Whenever I save it, Doom Emacs changes the format like this: application icoFoam; startFrom startTime; startTime 0; stopAt endTime; endTime 20; deltaT 0.05; writeControl runTime; I tried disabling `electric-indent-mode`, but it did not work. Anydoby knows how can I modify this behaviour? I just want to mantain the original format when saving a file. Thanks in advance!
LemonBreezes · 2022-02-03 16:03
Do you have `:editor (format +onsave)` enabled in your `init.el`? By the way, you'd probably get help a lot faster if you asked this in the Doom Emacs Discord. But my first guess is that you have the `+onsave` module flag enabled.
FourOmegaman · 2022-02-03 16:36
Yes, you are right! I had `:editor (format +onsave)` enabled, so once I disabled it in `init.el` it is working just as I wanted. Thanks!