Re: [BUG] Unintuitive indentation behavior when editing org-src blocks

2025-05-11 Thread Ihor Radchenko
Ihor Radchenko writes: >>> May you elaborate on the edge cases you encountered? >>> It may be a good idea to add such cases to the tests as well. >> >> I think they all reduced to the case where adding the spaces increased >> the minimum indent of the block, in which case `org-indent-line' would

Re: org-indent-line on the first line of src blocks when org-edit-src-content-indentation is non-zero (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-04-13 Thread Ihor Radchenko
l...@phdk.org writes: >> 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 th

Re: `org-indent-line' docstring is inaccurate for org-src-tab-acts-natively = nil (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-04-13 Thread Ihor Radchenko
l...@phdk.org writes: >> 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 expla

Re: `org-indent-line' indents the end tag of some blocks but doesn't do so with src blocks (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-04-11 Thread Ihor Radchenko
l...@phdk.org writes: >> Not just src-blocks, I think. >> Also other kinds of verbatim blocks: example blocks, latex environments, >> and comment blocks. > > All block elements which are not greater elements, so verse and export as > well. > Here's a cleaned up version of the patch. Thanks! Appl

Re: [BUG] Unintuitive indentation behavior when editing org-src blocks

2025-04-11 Thread Ihor Radchenko
l...@phdk.org writes: >> Applied, onto main. > Great! > >> May you elaborate on the edge cases you encountered? >> It may be a good idea to add such cases to the tests as well. > > I think they all reduced to the case where adding the spaces increased > the minimum indent of the block, in which ca

Re: `org-indent-line' docstring is inaccurate for org-src-tab-acts-natively = nil (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-04-05 Thread lra
> 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 indentin

Re: org-indent-line on the first line of src blocks when org-edit-src-content-indentation is non-zero (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-03-31 Thread lra
> 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 t

Re: `org-indent-line' indents the end tag of some blocks but doesn't do so with src blocks (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-03-31 Thread lra
> Not just src-blocks, I think. > Also other kinds of verbatim blocks: example blocks, latex environments, > and comment blocks. All block elements which are not greater elements, so verse and export as well. Here's a cleaned up version of the patch. > In the future, there will be :value-being/:v

Re: [BUG] Unintuitive indentation behavior when editing org-src blocks

2025-03-31 Thread lra
> Applied, onto main. Great! > May you elaborate on the edge cases you encountered? > It may be a good idea to add such cases to the tests as well. I think they all reduced to the case where adding the spaces increased the minimum indent of the block, in which case `org-indent-line' would remove

org-indent-line on the first line of src blocks when org-edit-src-content-indentation is non-zero (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-03-29 Thread Ihor Radchenko
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 descri

`org-indent-line' docstring is inaccurate for org-src-tab-acts-natively = nil (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-03-29 Thread Ihor Radchenko
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/desi

Re: [BUG] Unintuitive indentation behavior when editing org-src blocks

2025-03-29 Thread Ihor Radchenko
l...@phdk.org writes: > Thanks for the comments, I've attached the updated patch. > >> 1. Use `insert' rather than `insert-char' that is for interactive use. >> 2. Use more readable ?\t notation > > I realized that just inserting the spaces actually did mess up things > in some edge-cases so I cha

`org-indent-line' indents the end tag of some blocks but doesn't do so with src blocks (was: [BUG] Unintuitive indentation behavior when editing org-src blocks)

2025-03-29 Thread Ihor Radchenko
l...@phdk.org writes: > 1. `org-indent-line' indents the end tag of some blocks to match the > begin tag, but doesn't do so with src blocks, among others. > > MRE: With the pointer before =#+end_src=  in the following, do `M-x > org-indent-line' >   #+begin_src fundamental >     foo > #+end_src >

Re: [BUG] Unintuitive indentation behavior when editing org-src blocks

2025-03-27 Thread lra
Hi Ihor Thanks for the comments, I've attached the updated patch. > 1. Use `insert' rather than `insert-char' that is for interactive use. > 2. Use more readable ?\t notation I realized that just inserting the spaces actually did mess up things in some edge-cases so I changed approach. It feels

Re: [BUG] Unintuitive indentation behavior when editing org-src blocks

2025-03-25 Thread Ihor Radchenko
l...@phdk.org writes: > When adding a newline to an org-src block with > `org-src-tab-acts-natively' set to t, if there's a non-whitespace > character following the pointer at insertion, all other lines are > indented by an additional `org-edit-src-content-indentation' > regardless of their origin

Re: [BUG] Unintuitive indentation behavior when editing org-src blocks

2025-03-25 Thread Henrik Ahlgren
l...@phdk.org writes: > [1] I think this is what this thread was about: > https://list.orgmode.org/CALp=Ckko1Ck7-3K+bfKXLVSqDJvmHWYEZutkj5J2v3t=quv...@mail.gmail.com/T/#tO >   > Which was closed as not a bug, but since I feel I'm misunderstanding > either the original report or Ihor's answer I tho

[BUG] Unintuitive indentation behavior when editing org-src blocks

2025-03-25 Thread lra
When adding a newline to an org-src block with `org-src-tab-acts-natively' set to t, if there's a non-whitespace character following the pointer at insertion, all other lines are indented by an additional `org-edit-src-content-indentation' regardless of their original indentation. MRE with -Q on t