org-paste-subtree: Do not use `insert-before-markers'

* lisp/org.el (org-paste-subtree): Use `insert' instead of
`insert-before-markers'.  The former is what people usually expect and
doing otherwise is surprising.
* lisp/org-archive.el (org-archive-to-archive-sibling): Do not expect
`org-paste-subtree' to insert before markers.
This commit is contained in:
Ihor Radchenko 2022-07-31 13:03:04 +08:00
parent 24d2826f04
commit 2861d9cad8
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 3 additions and 1 deletions

View File

@ -453,6 +453,8 @@ Archiving time is retained in the ARCHIVE_TIME node property."
(setq leader (match-string 0)
level (funcall outline-level))
(setq pos (point-marker))
;; Advance POS upon insertion in front of it.
(set-marker-insertion-type pos t)
(condition-case nil
(outline-up-heading 1 t)
(error (setq e (point-max)) (goto-char (point-min))))

View File

@ -7054,7 +7054,7 @@ When REMOVE is non-nil, remove the subtree from the clipboard."
;; is inserted and then promoted.
(combine-change-calls beg beg
(when (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
(insert-before-markers txt)
(insert txt)
(unless (string-suffix-p "\n" txt) (insert "\n"))
(setq newend (point))
(org-reinstall-markers-in-region beg)