# Source blocks are indented

**URL:** <https://org-roam.discourse.group/t/source-blocks-are-indented/3031>\
**Category:** Troubleshooting\
**Created:** [March 26, 2023, 8:46am UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031 "2023-03-26T08:46:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![buhtz](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@buhtz](https://org-roam.discourse.group/u/buhtz)\
**Post date:** [March 26, 2023, 8:46am UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/1 "2023-03-26T08:46:56Z")

</div>

```auto
#+begin_src python
  import sys
#+end_src

```

This example shows a python source block in an orgroam file. OrgRoam always does an indention here of two spaces. Why? I see no advantage of that.

Is there a way to turn this of?

Here is a minimal init.el to reproduce

```auto
;; -*- lexical-binding: t; -*-
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
             ("elpa" . "https://elpa.gnu.org/packages/")))
;; Initializes the package infrastructure
(package-initialize)

;; === use-package ==
;; use-package to simplify the config file
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure 't)

;; === BASIC setup
(set-default-coding-systems 'utf-8)

;; === EVIL
(use-package evil
  :init
  (setq evil-want-integration t)
  (setq evil-want-keybinding nil)
  (setq evil-want-C-i-jump nil)
  :config
  (evil-mode 1)
  ;; Use visual line motions even outside of visual-line-mode buffers
  (evil-global-set-key 'motion "j" 'evil-next-visual-line)
  (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
  ;; Set "normal" vi-mode in specific buffers
  (evil-set-initial-state 'messages-buffer-mode 'normal)
  (evil-set-initial-state 'dashboard-mode 'normal)
  )

(use-package org)

```

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 26, 2023, 9:01am UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/2 "2023-03-26T09:01:00Z")

</div>

Perhaps its influenced by

`org-edit-src-content-indentation`

It’s not an Org-roam feature but an Org one; you might get quicker responses if you asked the wider Org community like the one on Reddit.

---

<div class="post-metadata">

**Author:** ![buhtz](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@buhtz](https://org-roam.discourse.group/u/buhtz)\
**Post date:** [March 26, 2023, 10:45am UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/3 "2023-03-26T10:45:22Z")

</div>

Thanks for the hint. Can’t find that symbol/function/variable. (Via C-h s or M-x)

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 26, 2023, 1:24pm UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/4 "2023-03-26T13:24:06Z")

</div>

Not sure why. I use Org version 9.6.

I got the information from [this StackExchange post](https://emacs.stackexchange.com/questions/69199/is-there-indentation-in-org-src-blocks) from 1 year and 4 months ago, it existed then (it seems to have been Org version 9.4.4).

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/f/f68ae6725ad07d071cd20bc2909d3db19a90d36a.png)

---

<div class="post-metadata">

**Author:** ![buhtz](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@buhtz](https://org-roam.discourse.group/u/buhtz)\
**Post date:** [March 26, 2023, 1:47pm UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/5 "2023-03-26T13:47:38Z")

</div>

I did more research reducing my init.el and looking which line in it  
does cause that behavior.

`(package-initialize)`

That is the one and only line in my init.el. The behavior is  
reproducible with this. Removing the line (init is empty then) the  
behavior is not there.

I’m not sure what this command/function does. But I assume something  
happens implicit with the packages installed.

What could it be?

When starting my emacs with `--debug-init` I have this in the message buffer. Nothing suspect I guess.

```auto
Loading /etc/emacs/site-start.d/00debian.el (source)...done
Loading /etc/emacs/site-start.d/50asymptote.el (source)...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50figlet.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...
Loading /usr/share/emacs/site-lisp/latex-cjk-common/cjk-enc.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)...done
Loading /etc/emacs/site-start.d/50latexmk.el (source)...done
Loading /etc/emacs/site-start.d/50lilypond-data.el (source)...done
Loading /etc/emacs/site-start.d/50pylint.el (source)...done
Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...done

```

---

<div class="post-metadata">

**Author:** ![buhtz](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@buhtz](https://org-roam.discourse.group/u/buhtz)\
**Post date:** [March 26, 2023, 2:03pm UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/6 "2023-03-26T14:03:45Z")

</div>

About `org-edit-src-content-indentation`: I have this variable. Sorry, I’m not sure what I made wrong in the first place looking for it. It’s value was 2. Setting it to 0 solves the problem.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 26, 2023, 2:07pm UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/7 "2023-03-26T14:07:03Z")

</div>

Try to check the value of variable `org-edit-src-content-indentation` again after you have loaded Org mode.

You say:

> [@buhtz](#):
>
> Can’t find that symbol/function/variable. (Via C-h s or M-x)

C-h s and M-x do not show documentation for a variable. It should be `describe-variable` (C-h v by default) or `describe-symbol` (C-h o by default).

You may not find it if `org` and `org-src` libraries are not loaded.

The behaviour of `package-initalize` somewhat depends on your Emacs version, and this variable:

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/e/e8ae6f71280650fded08d4eeb6e404395e5584f5.png)

`package-initialize` should not be the direct “cause” of what you see with the indentation. If I guess, something like this is happening:

1. You have set `package-enable-at-startup` nil somewhere in `early-init.el` (you may not have it, but you can check this variable, too)
2. When you launch Emacs, `init.el` calls `package-initialize`
3. This loads the packages in your `load-path`
4. One of the packages loads `org` and `org-src`, and by default, `org-edit-src-content-indentation` is set to 2

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 26, 2023, 2:07pm UTC](https://org-roam.discourse.group/t/source-blocks-are-indented/3031/8 "2023-03-26T14:07:59Z")

</div>

> [@buhtz](#):
>
> About `org-edit-src-content-indentation`: I have this variable. Sorry, I’m not sure what I made wrong in the first place looking for it. It’s value was 2. Setting it to 0 solves the problem.

Okay. I was just typing my previous response. Good to know.
