Doom-emacs: [HOWTO] avoid auto indent

Created on 25 Jul 2019  路  4Comments  路  Source: hlissner/doom-emacs

What I want to achieve
When I want to leave a blank line, there will be a red white space, I tried to disable whitespace-mode and add (setq show-trailing-whitespace nil) , the whitespace is still there. But after save the file, the whitespace will be gone.
CleanShot 2019-07-25 at 15 08 26

Further more, following a class, if I add a new class below, when type : the weired indent will show up. Not only the class , def are the same.
CleanShot 2019-07-25 at 15 08 50

All above behavior are using python-mode. Any info would be grateful, many thanks.

System information

  • OS: darwin (x86_64-apple-darwin14.5.0)
  • Shell: /usr/local/bin/zsh
  • Emacs: 26.1 (May 31, 2018)
  • Doom: 2.0.9 (HEAD -> develop, origin/develop, origin/HEAD f754d4ff 2019-07-23 18:23:17 +0200)
  • Graphic display: t (daemon: nil)
  • System features: NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS
  • Details:
    elisp env bootstrapper: envvar-file elc count: 0 uname -a: Darwin 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64 modules: (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor evil file-templates fold multiple-cursors rotate-text snippets :emacs dired electric vc :tools eval flycheck (lookup +docsets) magit :lang data emacs-lisp markdown (org +dragndrop +ipython +pandoc +present) python sh :config default) packages: (company-tabnine ox-gfm youdao-dictionary fcitx winum) exec-path: (~/git/bluelog/.venv/bin ~/.fzf/bin ~/.rbenv/shims ~/.cask/bin ~/bin ~/.local/bin /usr/local/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Applications/VMware Fusion.app/Contents/Public /usr/local/aria2/bin /Applications/Wireshark.app/Contents/MacOS ~/go/bin ~/.antigen/bundles/robbyrussell/oh-my-zsh/lib ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/common-aliases ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/colored-man-pages ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/extract ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/sudo ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/z ~/.antigen/bundles/djui/alias-tips ~/.antigen/bundles/andrewferrier/fzf-z ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/osx ~/.antigen/bundles/zsh-users/zsh-autosuggestions ~/.antigen/bundles/zdharma/fast-syntax-highlighting ~/.antigen/bundles/zsh-users/zsh-history-substring-search ~/.antigen/bundles/hlissner/zsh-autopair /usr/local/opt/fzf/bin ~/.emacs.d/bin ~/.emacs.d/bin /Applications/Emacs.app/Contents/MacOS/libexec/)
:core :emacs electric :lang python bug resolved

Most helpful comment

Using SPC h T for the profiler and inserting your example in python-mode and stopping the profiler with SPC h T reveals this to be electric-indent-mode, you'll probably want to disable that. As do I.
This is a module, remove electric from your init.el.

All 4 comments

Yes, I have experienced this problem too. It's so frustrating. I have just given up. I tried to isolate this issue but am unable to find out what exactly is causing it. I have tried disabling whitespace-mode and set show-trailing-whitespace to nil as well, but no luck.

For the trailing whitespace being red, I find that you have to edit whitespace-style so that it doesn't include trailing. You can do SPC h v and look it up to see what value it's set to, as well as what values you can set and what they're for.

As for the python issue with indenting, I don't believe that has anything to do with whitespace-mode. It would be related to the major/minor modes specific to python, and how they handle indenting.

So it's probably an issue with python-mode.

Using SPC h T for the profiler and inserting your example in python-mode and stopping the profiler with SPC h T reveals this to be electric-indent-mode, you'll probably want to disable that. As do I.
This is a module, remove electric from your init.el.

The reindentation is caused by the :emacs electric module.

The whitespace highlights was caused by these lines in core/core-ui.el.

As of 1e7df80 and ff5be98 on the straight branch, electric indentation (for python) and highlighted trailing whitespace is disabled. Let me know if that isn't the case and I'll reopen this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gilbertw1 picture gilbertw1  路  3Comments

Vvkmnn picture Vvkmnn  路  3Comments

governorgoat picture governorgoat  路  3Comments

driftcrow picture driftcrow  路  3Comments

Ptival picture Ptival  路  3Comments