When pasting a copied subtree, respect the whitelines before and after
* org.el (org-copy-subtree, org-paste-subtree): Fix whitespace handling when copying/pasting a subtree.
This commit is contained in:
parent
9333426c12
commit
ce4e0846b2
|
@ -7674,7 +7674,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
|
||||||
(if (org-called-interactively-p 'any)
|
(if (org-called-interactively-p 'any)
|
||||||
(org-back-to-heading nil) ; take what looks like a subtree
|
(org-back-to-heading nil) ; take what looks like a subtree
|
||||||
(org-back-to-heading t)) ; take what is really there
|
(org-back-to-heading t)) ; take what is really there
|
||||||
(org-back-over-empty-lines)
|
|
||||||
(setq beg (point))
|
(setq beg (point))
|
||||||
(skip-chars-forward " \t\r\n")
|
(skip-chars-forward " \t\r\n")
|
||||||
(save-match-data
|
(save-match-data
|
||||||
|
@ -7684,7 +7683,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
|
||||||
(org-forward-heading-same-level (1- n) t)
|
(org-forward-heading-same-level (1- n) t)
|
||||||
(error nil))
|
(error nil))
|
||||||
(org-end-of-subtree t t))
|
(org-end-of-subtree t t))
|
||||||
(org-back-over-empty-lines)
|
|
||||||
(setq end (point))
|
(setq end (point))
|
||||||
(goto-char beg0)
|
(goto-char beg0)
|
||||||
(when (> end beg)
|
(when (> end beg)
|
||||||
|
@ -7775,7 +7773,6 @@ the inserted text when done."
|
||||||
(delete-region (point-at-bol) (point)))
|
(delete-region (point-at-bol) (point)))
|
||||||
;; Paste
|
;; Paste
|
||||||
(beginning-of-line (if (bolp) 1 2))
|
(beginning-of-line (if (bolp) 1 2))
|
||||||
(unless for-yank (org-back-over-empty-lines))
|
|
||||||
(setq beg (point))
|
(setq beg (point))
|
||||||
(and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
|
(and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
|
||||||
(insert-before-markers txt)
|
(insert-before-markers txt)
|
||||||
|
|
Loading…
Reference in New Issue