emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Victor A. Stoichita" <victor@svictor.net>
To: Marco Wahl <marcowahlsoft@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: behavior of (org-insert-heading-respect-content)
Date: Fri, 17 Sep 2021 17:23:50 +0200	[thread overview]
Message-ID: <87czp74455.fsf@svictor.net> (raw)
In-Reply-To: <875yv4uvqr.fsf@gmail.com>


Le 13 Sep 2021, Marco Wahl <marcowahlsoft@gmail.com> a écrit :

> As far is I see it, the intended behavior of
> org-insert-heading-respect-content with point before the first heading
> is to
>
> - insert the new heading immediately before the first heading.  Respect
>   the content!
Hi Marco !

I agree with you. But this does not work. Say I have a buffer with this content :

--8<---------------cut here---------------start------------->8---
put point HERE and C-<return>
Some more stuff 
* Heading
content
--8<---------------cut here---------------end--------------->8---

When point is at HERE and I C-<return>, org inserts a new asterisk on
the after "stuff", but  on the same line → not a proper heading.
>
> - If there is no heading at all in the file the heading shall be
>   inserted at the bottom of the file.

Yes. But I get the same behavior with 
--8<---------------cut here---------------start------------->8---
put point HERE and C-<return>
Some more stuff 
--8<---------------cut here---------------end--------------->8---

The asterisk is inserted right after "stuff", on the same line → not
a proper heading.

>
> Do we agree on the desired behavior of
> org-insert-heading-respect-content?

Yes, we do!
>
> With your proposition the respect for the content gets lost,
> doesn't it?

Yes, you’re right. It currently does not respect the content before
first heading. Therefore it’s not a fix for the behavior of
org-insert-heading-respect-content.
It’s just the quickest workaround I’ve come up with to make my own
function work (in my use-case, when I call that function, either point
is at point-min in a brand new buffer, or point is below the first
heading).

Regards,
Victor



  reply	other threads:[~2021-09-17 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 14:55 behavior of (org-insert-heading-respect-content) Victor A. Stoichita
2021-09-09 18:54 ` Marco Wahl
2021-09-09 19:29   ` Victor A. Stoichita
2021-09-13 19:21     ` Marco Wahl
2021-09-17 15:23       ` Victor A. Stoichita [this message]
2021-09-18 13:08         ` Marco Wahl
2021-09-26 11:13           ` Bastien
2021-09-26 12:13             ` Marco Wahl
2021-09-26 12:31               ` Bastien
2021-09-26 19:57           ` Victor A. Stoichita

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87czp74455.fsf@svictor.net \
    --to=victor@svictor.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=marcowahlsoft@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).