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