From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: [PATCH 1/3] org.el: Remove duplicate code in `org-clone-subtree-with-time-shift'. Date: Sat, 22 May 2010 16:10:33 +0200 Message-ID: <1274537435-12497-2-git-send-email-dmaus@ictsoc.de> References: <1274537435-12497-1-git-send-email-dmaus@ictsoc.de> Return-path: Received: from [140.186.70.92] (port=37571 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFpQH-0005HF-LC for emacs-orgmode@gnu.org; Sat, 22 May 2010 10:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFpQG-0001lB-1p for emacs-orgmode@gnu.org; Sat, 22 May 2010 10:11:29 -0400 Received: from mysql1.xlhost.de ([213.202.242.106]:48233) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFpQF-0001l2-N7 for emacs-orgmode@gnu.org; Sat, 22 May 2010 10:11:27 -0400 In-Reply-To: <1274537435-12497-1-git-send-email-dmaus@ictsoc.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Operating on the clone (e.g. remove/recreated ID property) is independent on whether the subtree is cloned with time shift or not. --- lisp/org.el | 40 ++++++++++++++-------------------------- 1 files changed, 14 insertions(+), 26 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 6dcc520..c6d928b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7213,30 +7213,18 @@ and still retain the repeater to cover future instances of the task." (setq nmin 0 nmax (1+ nmax) n-no-remove nmax)) (goto-char end) (loop for n from nmin to nmax do - (if (not doshift) - (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 - (insert template) - (org-mode) - (goto-char (point-min)) - (and idprop (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))) - (goto-char (point-min)) + ;; prepare clone + (with-temp-buffer + (insert template) + (org-mode) + (goto-char (point-min)) + (and idprop (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))) + (goto-char (point-min)) + (when doshift (while (re-search-forward org-ts-regexp-both nil t) (org-timestamp-change (* n shift-n) shift-what)) (unless (= n n-no-remove) @@ -7245,8 +7233,8 @@ and still retain the repeater to cover future instances of the task." (save-excursion (goto-char (match-beginning 0)) (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)") - (delete-region (match-beginning 1) (match-end 1)))))) - (setq task (buffer-string)))) + (delete-region (match-beginning 1) (match-end 1))))))) + (setq task (buffer-string))) (insert task)) (goto-char beg))) -- 1.7.1