emacs-python-black icon indicating copy to clipboard operation
emacs-python-black copied to clipboard

`python-black-org-mode-block` doesn't respect `org-src-preserve-indentation`

Open nick4f42 opened this issue 1 year ago • 1 comments

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.

nick4f42 avatar Jul 04 '24 15:07 nick4f42

good catch. i do not use org myself. patches welcome 🙃

wbolster avatar Jul 04 '24 20:07 wbolster