0

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:

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;
}

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         20;

deltaT          0.05;

writeControl    runTime;

writeInterval   1;

purgeWrite      0;

writeFormat     ascii;

writePrecision  8;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

When I save it, Emacs changes the indentation like this:

FoamFile {
  version 2.0;
  format ascii;
  class dictionary;
  object controlDict;
}

application icoFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 20;

deltaT 0.05;

writeControl runTime;

writeInterval 1;

purgeWrite 0;

writeFormat ascii;

writePrecision 8;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

I tried disabling electric-indent-mode, but it did not work.

How can I modify this behaviour?

1 Answer 1

0

I just had to disable (format +onsave) in my init.el file. This is, just commenting out said line in:

:editor
       (evil +everywhere); come to the dark side, we have cookies
       file-templates    ; auto-snippets for empty files
       fold              ; (nigh) universal code folding
       ;;(format +onsave)  ; automated prettiness
       ;;god               ; run Emacs commands without modifier keys
       ;;lispy             ; vim for lisp, for people who don't like vim
       ;;multiple-cursors  ; editing in many places at once
       ;;objed             ; text object editing for the innocent
       ;;parinfer          ; turn lisp into python, sort of
       ;;rotate-text       ; cycle region at point between text candidates
       snippets          ; my elves. They type so I don't have to
       ;;word-wrap         ; soft wrapping with language-aware indent

made Emacs work as I wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.