If org-src-preserve-indentation is nil and org-edit-src-content-indentation is non-zero (both are by default), python-black-org-mode-block fails because of the indentation.
For example, with (setq-local org-src-preserve-indentation nil org-edit-src-content-indentation 2), this Org markup:
#+begin_src python
x = 1
#+end_src
corresponds to this code:
x = 1
But, our function currently sees it with extra indentation:
x = 1
org-edit-src-code is a user command for editing a source block in a different buffer, and it handles the indentation and de-indentation according to these settings. It also escapes certain characters, as #18 addressed. It does update the window configuration though, so we'd have to work around that if we were to use it.
If
org-src-preserve-indentation
is nil andorg-edit-src-content-indentation
is non-zero (both are by default),python-black-org-mode-block
fails because of the indentation.For example, with
(setq-local org-src-preserve-indentation nil org-edit-src-content-indentation 2)
, this Org markup:corresponds to this code:
But, our function currently sees it with extra indentation:
org-edit-src-code
is a user command for editing a source block in a different buffer, and it handles the indentation and de-indentation according to these settings. It also escapes certain characters, as #18 addressed. It does update the window configuration though, so we'd have to work around that if we were to use it.