all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [Bug] incorrect indent of next heading after org-paste-subtree
Date: Sun, 1 May 2022 18:54:59 -0700	[thread overview]
Message-ID: <CAJcAo8vjbnhhCLLVFg32dSviNK2a5gSA1O_8LZTFP0uc61xhNA@mail.gmail.com> (raw)
In-Reply-To: <so52na$ble$1@ciao.gmane.io>

fwiw
[idk if this is useful but here just in case]

iirc, outline mode does not include the final newline for subtrees in
at least one case.

yet, many users and much code assume or ensure that lines are
terminated with a final newline.

this can result in unexpected behavior.  it required code to ensure
compatibility and flexibility, and it required consideration for edge
cases.  sometimes the workarounds would have to be worked around by
the calling code.

core emacs code like sorting assumed/assumes newline.

org would assume or provide none in some [but not all] cases.

user or package code might naturally kill a subtree by killing the
whole line when folded or killing each of the lines.  those include
final newline.  or set require-final-newline.  this is anissue for
things similar to editing source blocks or capture.

the usual bugs were unexpected presence or absence of newlines.  idk
if htat might help you debug or not.


On 11/30/21, Max Nikulin <manikulin@gmail.com> wrote:
> Another old bug with org-paste-subtree.
>
> It make indentation of next heading wrong.
>
> Consider the following document and follow described steps:
>
> ---- >8 ----
> #+STARTUP: indent
> Enable soft indent mode
>
> Put to kill ring some text *without trailing newline*
> that represents a subtree. In my case it is generated
> by a browser extension.
> #+begin_src elisp :results silent
>    (kill-new "* Pasted Header\nPasted body")
> #+end_src
>
> Several levels of heading to make the problem apparent:
> * H1
> ** H2
> Ensure that the following "H3" heading is expanded,
> put cursor to this line and try =C-c C-x C-y=
> or [[elisp:(org-paste-subtree)]]
> *** H3
> :PROPERTIES:
> :CUSTOM_ID: h3
> :END:
> Body
> ---- 8< ----
>
> Actual result:
>
> ---- >8 ----
> Several levels of heading to make the problem apparent:
> * H1
> *** H2
>      Ensure that the following "H3" heading is expanded,
>      put cursor to this line and try =C-c C-x C-y=
>      or elisp:(org-paste-subtree)
> ***** Pasted Header
>        Pasted body
> ***** H3
>    :PROPERTIES:
>    :CUSTOM_ID: h3
>    :END:
>    Body
> ---- 8< ----
>
> Expected result
>
> ---- >8 ----
> Several levels of heading to make the problem apparent:
> * H1
> *** H2
>      Ensure that the following "H3" heading is expanded,
>      put cursor to this line and try =C-c C-x C-y=
>      or elisp:(org-paste-subtree)
> ***** Pasted Header
>        Pasted body
> ***** H3
>        :PROPERTIES:
>        :CUSTOM_ID: h3
>        :END:
>        Body
> ---- 8< ----
>
> Org mode version 9.5 (release_9.5-225-g494c20
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


      parent reply	other threads:[~2022-05-02  1:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 11:42 [Bug] incorrect indent of next heading after org-paste-subtree Max Nikulin
2022-05-01  2:31 ` Ihor Radchenko
2022-05-01 11:09   ` Max Nikulin
2022-05-02  4:00     ` Ihor Radchenko
2022-05-02  7:29       ` Max Nikulin
2022-05-02 23:32       ` Samuel Wales
2022-05-03  1:21         ` Ihor Radchenko
2022-07-17  8:52       ` Ihor Radchenko
2022-05-02  1:54 ` Samuel Wales [this message]

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=CAJcAo8vjbnhhCLLVFg32dSviNK2a5gSA1O_8LZTFP0uc61xhNA@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@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 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.