From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: [PATCH] Maybe create ID property in cloned subtrees. Date: Wed, 19 May 2010 20:14:24 +0200 Message-ID: <1274292864-4161-2-git-send-email-dmaus@ictsoc.de> References: Return-path: Received: from [140.186.70.92] (port=36664 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEnnn-0004SE-Se for emacs-orgmode@gnu.org; Wed, 19 May 2010 14:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OEnnl-000866-Ci for emacs-orgmode@gnu.org; Wed, 19 May 2010 14:15:31 -0400 Received: from mysql1.xlhost.de ([213.202.242.106]:36085) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OEnni-00085g-VK for emacs-orgmode@gnu.org; Wed, 19 May 2010 14:15:28 -0400 In-Reply-To: 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 --- lisp/ChangeLog | 2 ++ lisp/org.el | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 01672a0..ec2fa36 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * org.el (org-refile-cache-get): Return empty list of targets when cache was cleared. + (org-clone-subtree-with-time-shift): Maybe create ID property + in cloned subtrees. 2010-05-17 Carsten Dominik diff --git a/lisp/org.el b/lisp/org.el index 4ede91f..64da60a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7170,7 +7170,7 @@ the following will happen: I this way you can spell out a number of instances of a repeating task, and still retain the repeater to cover future instances of the task." (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ") - (let (beg end template task + (let (beg end template task idprop shift-n shift-what doshift nmin nmax (n-no-remove -1)) (if (not (and (integerp n) (> n 0))) (error "Invalid number of replications %s" n)) @@ -7187,15 +7187,11 @@ and still retain the repeater to cover future instances of the task." (setq nmin 1 nmax n) (org-back-to-heading t) (setq beg (point)) + (setq idprop (org-entry-get nil "ID")) (org-end-of-subtree t t) (or (bolp) (insert "\n")) (setq end (point)) - (setq template (let ((tmpl (buffer-substring beg end))) - (with-temp-buffer - (insert tmpl) - (org-mode) - (org-entry-delete nil "ID") - (buffer-string)))) + (setq template (buffer-substring beg end)) (when (and doshift (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template)) (delete-region beg end) @@ -7204,11 +7200,17 @@ and still retain the repeater to cover future instances of the task." (goto-char end) (loop for n from nmin to nmax do (if (not doshift) - (setq task template) + (setq task (if (not idprop) template + (with-temp-buffer + (insert template) + (org-mode) + (org-id-get-create t) + (buffer-string)))) (with-temp-buffer (insert template) (org-mode) (goto-char (point-min)) + (if idprop (org-id-get-create t)) (while (re-search-forward org-ts-regexp-both nil t) (org-timestamp-change (* n shift-n) shift-what)) (unless (= n n-no-remove) -- 1.7.1