Skip to content

Commit

Permalink
org-paste-subtree: Do not use `insert-before-markers'
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
yantar92 committed Jul 31, 2022
1 parent 24d2826 commit 2861d9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lisp/org-archive.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down
2 changes: 1 addition & 1 deletion lisp/org.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2861d9c

Please sign in to comment.