0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-12 08:10:07 +00:00

org.el: Remove duplicate code in `org-clone-subtree-with-time-shift'.

Operating on the clone (e.g. remove/recreated ID property) is
independent on whether the subtree is cloned with time shift or not.
This commit is contained in:
David Maus 2010-05-22 19:10:33 +00:00 committed by John Wiegley
parent a3e5a2f7e4
commit 5349014e82

View file

@ -7217,20 +7217,7 @@ and still retain the repeater to cover future instances of the task."
(setq nmin 0 nmax (1+ nmax) n-no-remove nmax)) (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
(goto-char end) (goto-char end)
(loop for n from nmin to nmax do (loop for n from nmin to nmax do
(if (not doshift) ;; prepare clone
(setq task (if (not idprop) template
(with-temp-buffer
(insert template)
(org-mode)
(goto-char (point-min))
(if org-clone-delete-id
(org-entry-delete nil "ID")
(org-id-get-create t))
(while (re-search-forward
org-property-drawer-re nil t)
(org-remove-empty-drawer-at
"PROPERTIES" (point)))
(buffer-string))))
(with-temp-buffer (with-temp-buffer
(insert template) (insert template)
(org-mode) (org-mode)
@ -7241,6 +7228,7 @@ and still retain the repeater to cover future instances of the task."
(while (re-search-forward org-property-drawer-re nil t) (while (re-search-forward org-property-drawer-re nil t)
(org-remove-empty-drawer-at "PROPERTIES" (point))) (org-remove-empty-drawer-at "PROPERTIES" (point)))
(goto-char (point-min)) (goto-char (point-min))
(when doshift
(while (re-search-forward org-ts-regexp-both nil t) (while (re-search-forward org-ts-regexp-both nil t)
(org-timestamp-change (* n shift-n) shift-what)) (org-timestamp-change (* n shift-n) shift-what))
(unless (= n n-no-remove) (unless (= n n-no-remove)
@ -7249,8 +7237,8 @@ and still retain the repeater to cover future instances of the task."
(save-excursion (save-excursion
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
(if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)") (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)")
(delete-region (match-beginning 1) (match-end 1)))))) (delete-region (match-beginning 1) (match-end 1)))))))
(setq task (buffer-string)))) (setq task (buffer-string)))
(insert task)) (insert task))
(goto-char beg))) (goto-char beg)))