org-mode: Suppress indentation of list items and code blocks reddit / emacs ---------------------------------------------------------------------- dotancohen · 2022-09-19 08:00 I use Emacs 27.1 with org-mode and Evil. Currently my setup has these two indentation features: 1. Headings and content are _displayed_ indented, even though there is no leading whitespace on the line. 2. When editing a code block, leading whitespace is added to the new line and sometimes the entire code block has leading whitespace added to it. I would like to keep the first feature (which I think is provided by `evil-auto-indent`). I would like to disable the second feature, which I could not figure out with much experimentation and googling. Of specific interest is the `org-indent-mode` setting, which when set to `t` seems to be the feature that provides feature 1. But what is providing feature 2? I've tried playing with `org-adapt-indentation` but I'm not sure if I should be setting it as `(setq org-adapt- indentation nil)` or possibly `(org-adapt-indentation nil)` and no matter what I do I still get that leading whitespace added to code blocks. **How do I preserve the virtual indention yet prevent the insertion of whitespace?** The relevant parts of my `~/.emacs` file are: ; Open only a single window. ; https://stackoverflow.com/questions/29915133/how-can-i-open-the- files-only-in-a-specific-window-in-emacs (setq inhibit-splash-screen t) ; Start maximized (add-to-list 'default-frame-alist '(fullscreen . maximized)) ; Vim Emulation ; https://emacs.amodernist.com/ (unless (package-installed-p 'evil) (package-refresh-contents) (package-install 'evil)) ; Proper Tab-key behaviour in org-mode ; Must be set before enabling evil ; https://stackoverflow.com/questions/22878668/emacs-org-mode- evil-mode-tab-key-not-working (setq evil-want-C-i-jump nil) ; Enable Evil (require 'evil) (evil-mode 1) ; Enable org-evil ; https://github.com/GuiltyDolphin/org-evil (require 'org-evil) ; Have _ be considered part of a word in evil ; https://emacs.stackexchange.com/questions/9583/how-to-treat- underscore-as-part-of-the-word ; https://github.com/emacs-evil/evil/issues/721 (modify-syntax-entry ?_ "w") ; esc quits pretty much anything (like pending prompts in the minibuffer) ; https://modulitos.com/blog/lightning-intro-to-emacs-using-evil- mode-and-org-mode/ (define-key evil-normal-state-map [escape] 'keyboard-quit) (define-key evil-visual-state-map [escape] 'keyboard-quit) (define-key minibuffer-local-map [escape] 'minibuffer-keyboard- quit) (define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard- quit) (define-key minibuffer-local-completion-map [escape] 'minibuffer- keyboard-quit) (define-key minibuffer-local-must-match-map [escape] 'minibuffer- keyboard-quit) (define-key minibuffer-local-isearch-map [escape] 'minibuffer- keyboard-quit) ; Ctrl-C W Toggle word wrap ; https://emacs.stackexchange.com/questions/30171/how-do-i-toggle- soft-wrapped-lines-in-org-mode (global-set-key (kbd "C-c w") 'toggle-truncate-lines) ; Run these options only in org-mode ; https://modulitos.com/blog/lightning-intro-to-emacs-using-evil- mode-and-org-mode/ (add-hook 'org-mode-hook (lambda() ; Reenable