all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gustavo Barros <gusbrs.2016@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: org-insert-heading-respect-content before first heading [9.4 (9.4-19-gb1de0c-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20201019/)]
Date: Sun, 02 May 2021 14:11:12 -0300	[thread overview]
Message-ID: <87y2cxoybz.fsf@gmail.com> (raw)
In-Reply-To: <87tunlmxqu.fsf@bzg.fr>

Hi Bastien,

On Sun, 02 May 2021 at 03:54, Bastien <bzg@gnu.org> wrote:

> Hi Gustavo,
>
> Gustavo Barros <gusbrs.2016@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.


  reply	other threads:[~2021-05-02 17:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21 14:18 Bug: org-insert-heading-respect-content before first heading [9.4 (9.4-19-gb1de0c-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20201019/)] Gustavo Barros
2021-05-01 16:02 ` Bastien
2021-05-02  3:07   ` Gustavo Barros
2021-05-02  6:54     ` Bastien
2021-05-02 17:11       ` Gustavo Barros [this message]
2021-05-06 11:53         ` Bastien
2021-05-06 12:15           ` Gustavo Barros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2cxoybz.fsf@gmail.com \
    --to=gusbrs.2016@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.