emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: emacs-orgmode@gnu.org
Subject: [PATCH 3/3] Remove empty property drawers in cloned subtrees.
Date: Wed, 19 May 2010 20:53:27 +0200	[thread overview]
Message-ID: <1274295207-4961-3-git-send-email-dmaus@ictsoc.de> (raw)
In-Reply-To: <1274295207-4961-1-git-send-email-dmaus@ictsoc.de>

---
 lisp/ChangeLog |    2 ++
 lisp/org.el    |    7 +++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ba65761..7c743a1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -7,6 +7,8 @@
 	(org-clone-delete-id): New customization variable.
 	(org-clone-subtree-with-time-shift): Use customization
 	variable `org-clone-delete-id'.
+	(org-clone-subtree-with-time-shift): Remove empty property
+	drawer in cloned subtrees.
 
 2010-05-17  Carsten Dominik  <carsten.dominik@gmail.com>
 
diff --git a/lisp/org.el b/lisp/org.el
index 88d636d..db0f5e2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7215,6 +7215,10 @@ and still retain the repeater to cover future instances of the task."
 			     (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)
@@ -7223,6 +7227,9 @@ and still retain the repeater to cover future instances of the task."
 	      (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))
 	      (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

      parent reply	other threads:[~2010-05-19 18:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 18:53 [PATCH 0/2] org.el: Customize subtree cloning + remove empty property drawer after cloning David Maus
2010-05-19 18:53 ` [PATCH 2/3] Provide customization variable `org-clone-delete-id' David Maus
2010-05-19 21:35   ` Carsten Dominik
2010-05-20  5:48     ` David Maus
2010-05-19 18:53 ` David Maus [this message]

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=1274295207-4961-3-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).