Browse Source

Remove empty property drawers in cloned subtrees.

David Maus 15 years ago
parent
commit
6f1bd65fb6
2 changed files with 9 additions and 0 deletions
  1. 2 0
      lisp/ChangeLog
  2. 7 0
      lisp/org.el

+ 2 - 0
lisp/ChangeLog

@@ -15,6 +15,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>
 

+ 7 - 0
lisp/org.el

@@ -7216,6 +7216,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)
@@ -7224,6 +7228,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)