l...@phdk.org writes: > On the content indent, my confusion arose due to the fact that nothing > in the chain of descriptions related to it gave any indication that > the customization on code indentation should impact it. > 1. `org-src-tab-acts-natively' itself doesn't mention it. > 2. The description of `org-edit-src-content-indentation' says nothing > about `org-src-tab-acts-natively', it mentions > `org-src-preserve-indentation'; but > 3. That one also doesn't say anything about > `org-src-tab-acts-natively'. It does specifically mention that > `org-indent-block' should add the content indent; but > 4. The descriptions of `org-indent-block' and `-region', which it > relies on, are both very low on detail so the intended behavior is > unclear; in any case `org-indent-region' only adds the content > indent when native tab is enabled. > > Point being that it is unclear whether `tab-acts-natively' is at all > supposed to change how and when the content indent is added. > > Currently the content indent is added when returning from the edit > buffer, so, despite the bug, it's skipped when native indenting is > disabled since the edit buffer isn't used. I personally don't think it > makes a lot of sense that the value of `tab-acts-natively' should > affect this behavior, see for example the MRE below. IMO it should > only regard the code indentation and not whether org indents the block > content. > > MRE for lack of content indentation: > With `org-src-tab-acts-natively' and `org-src-preserve-indentation' > set to nil and above-zero `org-edit-src-content-indentation', press > enter at the end of a src block header. > > #+begin_src fundamental<pointer> > #+end_src > > My expectation: you are placed at the content indent. > Actual: You are placed at column 0. > > I didn't prepare a patch since my favored solutions would require > changes to multiple functions including descriptions, so I thought I'd > hear your thoughts before putting in the effort.
This sounds like inconsistency in the meaning of `org-edit-src-content-indentation'. Its docstring says that it only applies when returning from editing buffer, but de facto is affects more places in Org: 1. It implicitly takes effect when `org-src-tabs-act-natively' because of the implemetation details 2. It is used by `org-babel-update-block-body' 3. It affects `org-element-example-block-interpreter' and `org-element-src-block-interpreter' I believe that we should 1. Rename org-edit-src-content-indentation to org-src-content-indentation and update the docstring clarifying that the variable affects inedntation, editing, and printing the AST. 2. Update `org--get-expected-indentation' to treat blank lines at the beginning of src/example blocks according to org-src-content-indentation -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>