1

The problem

When editing code blocks, I usually opens a new buffer by pressing C-c ' (i.e. executing org-edit-special). The problem is that when I finish editing the buffer, two spaces are inserted to the beginning of each line which is something I don't want so I would like to make org-edit-special not insert those spaces after finishing editing the buffer that it opens.

In the gif shown below, you can see how two spaces are inserted at the beginning of each line after exiting the buffer that org-edit-special opens.

enter image description here

Some notes

  • I started emacs with emacs -Q to avoid my configuration interfere with the default functionality oforg-mode.
  • The gif starts when the black box appears at the right top corner and finishes when the C-c / key is pressed (it is shown by screenkey).
2
  • Are you looking for org-edit-src-content-indentation?
    – gusbrs
    Sep 13 '20 at 10:50
  • Yep. Writing (setq org-edit-src-content-indentation 0) in my config solved the problem.
    – doltes
    Sep 13 '20 at 11:11
1

Pressing C-c ' executes org-edit-special. This functions calls org-edit-src-code when the cursor is inside a source code block.

The following quote was retrieved from the documentation of the variable org-edit-src-content-indentation.

This should be the number of spaces added to the indentation of the #+begin line in order to compute the indentation of the block content after editing it with ‘M-x org-edit-src-code’.

So if you want no spaces to be added to each line, you need to set that value to 0.

(setq org-edit-src-content-indentation 0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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