buhtz
March 26, 2023, 8:46am
1
#+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
;; -*- 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)
nobiot
March 26, 2023, 9:01am
2
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.
buhtz
March 26, 2023, 10:45am
3
Thanks for the hint. Can’t find that symbol/function/variable. (Via C-h s or M-x)
nobiot
March 26, 2023, 1:24pm
4
Not sure why. I use Org version 9.6.
I got the information from this StackExchange post from 1 year and 4 months ago, it existed then (it seems to have been Org version 9.4.4).
1 Like
buhtz
March 26, 2023, 1:47pm
5
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.
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
buhtz
March 26, 2023, 2:03pm
6
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.
1 Like
nobiot
March 26, 2023, 2:07pm
7
Try to check the value of variable org-edit-src-content-indentation
again after you have loaded Org mode.
You say:
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:
package-initialize
should not be the direct “cause” of what you see with the indentation. If I guess, something like this is happening:
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)
When you launch Emacs, init.el
calls package-initialize
This loads the packages in your load-path
One of the packages loads org
and org-src
, and by default, org-edit-src-content-indentation
is set to 2
1 Like
nobiot
March 26, 2023, 2:07pm
8
Okay. I was just typing my previous response. Good to know.
1 Like