Hi Bastien,
On Sun, 02 May 2021 at 03:54, Bastien <b...@gnu.org> wrote:
Hi Gustavo,
Gustavo Barros <gusbrs.2...@gmail.com> writes:
I just tested the fix and, indeed,
`org-insert-heading-respect-content' no longer breaks the structure
of
the first heading. However, if I may add a nitpick, the value of
`org-blank-before-new-entry' does not seem to be honored in this
case.
For default values, a distance of one blank line is ensured to the
next heading.
My understanding is that `org-blank-before-new-entry' will ensure
there is a blank line before the new entry, which is what I see.
Let me know if there is something I miss here. Thanks!
Indeed, that's why I said I'm not sure `org-blank-before-new-entry' is
the culprit here. Still, there is a difference of behavior in that
regard if point is before or after the fist heading. An ECM to
reproduce it is the following.
From the situation ("|" represents point position), call `C-RET':
#+begin_src org
,#+title: Title
|
,* Foo
,* Bar
,* Baz
#+end_src
The result is:
#+begin_src org
,#+title: Title
,* |
,* Foo
,* Bar
,* Baz
#+end_src
Now move point to:
#+begin_src org
,#+title: Title
,*
,* Foo
,* Bar
|
,* Baz
#+end_src
And call `C-RET'. The result is:
#+begin_src org
,#+title: Title
,*
,* Foo
,* Bar
,* |
,* Baz
#+end_src
Not quite sure what is the cause, and also not absolutely sure what
would be expected behavior. Since, if we now place point at:
#+begin_src org
,#+title: Title
,*
,* Foo
|
,* Bar
,*
,* Baz
#+end_src
And call `C-RET', we get:
#+begin_src org
,#+title: Title
,*
,* Foo
,* |
,* Bar
,*
,* Baz
#+end_src
My guess, and this is just a hunch, is that the default value of
`org-blank-before-new-entry', which by default is `auto' for `heading'
is somehow backward looking, and hence has somewhat of a hard time in
making the said "intelligent decision" as to how many blank lines to
include. Particularly before the first heading.
Indeed, I can understand the last case in that perspective, since the
first heading we inserted has no blank line to "Foo", so that when
inserting a new heading between "Foo" and "Bar" if we look right above
"no blank line" is the rule to infer. And, if that first heading is
removed, inserting a new one there, will behave just as it does between
"Bar" and "Baz".
This was all tested with `emacs -Q', version 27.2, and Org commit
3e497bec3. No variables changed, thus out-of-the-box experience.
Anyway, as mentioned, "nitpick" level stuff, since you asked for
testing.
Best regards,
Gustavo.