I noticed that clean-aindent-mode is messing up the indentation as I am writing python files. Hence, I wanted to disable this mode, at least when using python mode.

I can manually disable this mode, but I was wondering what the correct code was to disable clean-aindent-mode in my spacemacs configuration file? I imagine it is something simple, but I don't really know emacs lisp.


1 Answer 1


It seems to have been added to a recent Spacemacs dev branch. Press SPC-f-e-d to open your config file, find the */init section as shown below, and add in the one liner to disable.

(defun dotspacemacs/init ()
This function is called at the very beginning of Spacemacs startup,
before layer configuration.
It should only modify the values of Spacemacs settings."
   ;; If non nil activate `clean-aindent-mode' which tries to correct
   ;; virtual indentation of simple modes. This can interfer with mode specific
   ;; indent handling like has been reported for `go-mode'.
   ;; If it does deactivate it here.
   ;; (default t)
   dotspacemacs-use-clean-aindent-mode nil

  • thanks for the response to the question. I found that I needed to do (setq dotspacemacs-use-clean-aindent-mode nil) to get this to work. Does that make sense to you? I am not an elisp programmers, so I don't really know the syntax that well.
    – krishnab
    Aug 13, 2020 at 16:06
  • 1
    That is equivalent, though Spacemacs suggests putting all dotspacemacs-* variables inside that dotspacemacs/init block.
    – hyiltiz
    Aug 13, 2020 at 19:31
  • Okay cool. Yes, thanks for clarifying. Someday I will sit down and work through all of the elisp tutorials :).
    – krishnab
    Aug 13, 2020 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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