emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <1274537435-12497-2-git-send-email-dmaus@ictsoc.de> (raw)
In-Reply-To: <1274537435-12497-1-git-send-email-dmaus@ictsoc.de>

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

  reply	other threads:[~2010-05-22 14:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-22 14:10 [PATCH 0/3] Proper serializing of publishing cache + refactor `org-clone-subtree-with-time-shift' David Maus
2010-05-22 14:10 ` David Maus [this message]
2010-05-22 14:10 ` [PATCH 2/3] Serialize publishing project cache with `puthash' expressions David Maus
2010-05-23  5:56   ` Carsten Dominik
2010-05-23 14:22     ` Sebastian Rose
2010-05-25  9:41       ` Carsten Dominik
2010-05-22 14:10 ` [PATCH 3/3] Update ChangeLog for 37e0fa88c1b0b691e2933808dc6dbcdd886de6af and ba62b4a448ba3f9781c94bed57f60cee50b04c25 David Maus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274537435-12497-2-git-send-email-dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).