emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug] incorrect indent of next heading after org-paste-subtree


From: Samuel Wales
Subject: Re: [Bug] incorrect indent of next heading after org-paste-subtree
Date: Sun, 1 May 2022 18:54:59 -0700

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]