> According to
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f58201b1e1b0788098b1bbca45e06e015f5b0b7b
> the current behavior is intentional. So, I believe that the bug is in
> the docstring that has not been updated in that commit.

That would explain it.

> Note that indenting region and a single line are not the same.
> Indenting a single line should ideally not touch any other lines, which
> puts limitations on the allowed logic. 

Is there a reason for `org-indent-region' and `org-indent-line' to
have separate behaviors in src-blocks in this case? I'm not sure I
understand the reason that disabling `org-src-tab-acts-natively'
should disable `org-indent-region' but not `org-indent-line'. Wouldn't
it make more sense to have marking a region and running
`org-indent-region' result in the same indentation as going top to
bottom pressing TAB on each line individually?

> I am not 100% sure what exactly is the problem in the docstring of
> `org-src-tab-acts-natively'. 

>From a user perspective, `org-src-tab-acts-natively' is currently
enabled by default but the docstring doesn't itself give any clear
indication of how indentation will behave if it is disabled (or why
one might do this). You need to go to `org-indent-line' to find out.

>From a maintenance perspective, I was going through the behavior after
disabling it and had no real idea which of the current behaviors were
intended.

LRA



Mar 29, 2025, 11:45 by yanta...@posteo.net:

>
> l...@phdk.org writes:
>
>> 2. At first I just wanted to report that tabbing with
>> `org-src-tab-acts-natively' at nil didn't follow
>> `org-edit-src-content-indentation', but looking into it I realize
>> there's a nuance to it. I think there is one "actual" bug and two
>> ambiguities in intention/design. The description of `org-indent-line'
>> says:
>>
>>> - In the code part of a source block, use language major mode
>>>
>> to indent current line if ‘org-src-tab-acts-natively’ is
>> non-nil.  *If it is nil, do nothing.*   (<-- This is the current behavior of 
>> `org-indent-region' and therefore `org-indent-block')
>>
>>>
>>> - Otherwise, *indent like the first non-blank line above.* (<-- This is the 
>>> current behavior of `org-indent-line')
>>>
>
> Note that indenting region and a single line are not the same.
> Indenting a single line should ideally not touch any other lines, which
> puts limitations on the allowed logic. We partially defy this when using
> `org-src-tab-acts-natively', which is mostly design limitation of the
> `org-babel-do-in-edit-buffer'
>
>> MRE:
>> With `org-src-tab-acts-natively' set to nil and pointer in content of the 
>> following, press TAB.
>> #+begin_src fundamental
>>    foo
>> bar
>> #+end_src
>> Expected: Nothing happens.
>> Actual: Indent is set to 3, equal to line above.
>>
>> So that's the actual bug, nothing with the content indent
>> specifically. However, I'm not sure that bringing it in line with the
>> description is necessarily what makes best sense. Right now there's
>> even a test that contradicts the function description, and the
>> description of `org-src-tab-acts-natively' also doesn't say anything
>> about what happens when it is set to nil. I can't speak for the people
>> who already use this setting, but having TAB fall back to the current
>> behavior of `org-indent-line' makes more intuitive sense to me than
>> having TAB do nothing when you disable native indent.
>>
>
> According to
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f58201b1e1b0788098b1bbca45e06e015f5b0b7b
> the current behavior is intentional. So, I believe that the bug is in
> the docstring that has not been updated in that commit.
>
>> I think it needs to be clarified whether the intent of the customization is
>> to completely disable all auto-indentation of code from the
>> org-buffer; versus just disabling the use of temporary edit-buffers at
>> every newline/TAB, e.g. to get around issues with language modes or
>> slow-downs or whatever.
>>
>> (I guess having all three settings could also make sense, since just keeping
>> your fingers off of TAB wouldn't fully achieve the `do nothing' mode.)
>>
>
> I am not 100% sure what exactly is the problem in the docstring of
> `org-src-tab-acts-natively'. 
>
> -- 
> 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>
>


Reply via email to