emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 0/2] org.el: Customize subtree cloning + remove empty property drawer after cloning
@ 2010-05-19 18:53 David Maus
  2010-05-19 18:53 ` [PATCH 2/3] Provide customization variable `org-clone-delete-id' David Maus
  2010-05-19 18:53 ` [PATCH 3/3] Remove empty property drawers in cloned subtrees David Maus
  0 siblings, 2 replies; 5+ messages in thread
From: David Maus @ 2010-05-19 18:53 UTC (permalink / raw)
  To: emacs-orgmode

First patch adds customization variable `org-clone-delete-id' that
controls whether or not clones of a subtree shall inherit the ID
property (with a new value), second one removes empty property drawer
after cloning.

Available at git://github.com/dmj/dmj-org-mode.git quickfix

David Maus (3):
  Maybe create ID property in cloned subtrees.
  Provide customization variable `org-clone-delete-id'.
  Remove empty property drawers in cloned subtrees.

 lisp/ChangeLog |    7 +++++++
 lisp/org.el    |   37 +++++++++++++++++++++++++++++--------
 2 files changed, 36 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] Provide customization variable `org-clone-delete-id'.
  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 ` David Maus
  2010-05-19 21:35   ` Carsten Dominik
  2010-05-19 18:53 ` [PATCH 3/3] Remove empty property drawers in cloned subtrees David Maus
  1 sibling, 1 reply; 5+ messages in thread
From: David Maus @ 2010-05-19 18:53 UTC (permalink / raw)
  To: emacs-orgmode

When non-nil, clones of a subtree don't inherit the ID property.
Otherwise they do and it will be set to a new unique identifier.
---
 lisp/ChangeLog |    3 +++
 lisp/org.el    |   16 ++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ec2fa36..ba65761 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -4,6 +4,9 @@
 	when cache was cleared.
 	(org-clone-subtree-with-time-shift): Maybe create ID property
 	in cloned subtrees.
+	(org-clone-delete-id): New customization variable.
+	(org-clone-subtree-with-time-shift): Use customization
+	variable `org-clone-delete-id'.
 
 2010-05-17  Carsten Dominik  <carsten.dominik@gmail.com>
 
diff --git a/lisp/org.el b/lisp/org.el
index 64da60a..88d636d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -105,6 +105,13 @@
 (require 'org-footnote)
 
 ;;;; Customization variables
+(defcustom org-clone-delete-id nil
+  "Remove ID property of clones of a subtree.
+When non-nil, clones of a subtree don't inherit the ID property.
+Otherwise they inherit the ID property with a new unique
+identifier."
+  :type 'boolean
+  :group 'org-id)
 
 ;;; Version
 
@@ -7204,13 +7211,18 @@ and still retain the repeater to cover future instances of the task."
 			   (with-temp-buffer
 			     (insert template)
 			     (org-mode)
-			     (org-id-get-create t)
+			     (goto-char (point-min))
+			     (if org-clone-delete-id
+				 (org-entry-delete nil "ID")
+			       (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))
+	      (and idprop (if org-clone-delete-id
+			      (org-entry-delete nil "ID")
+			    (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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] Remove empty property drawers in cloned subtrees.
  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 18:53 ` David Maus
  1 sibling, 0 replies; 5+ messages in thread
From: David Maus @ 2010-05-19 18:53 UTC (permalink / raw)
  To: emacs-orgmode

---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] Provide customization variable `org-clone-delete-id'.
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2010-05-19 21:35 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode Mode

Hi David, do you have these patches on a branch?

Thanks!

- Carsten

On May 19, 2010, at 8:53 PM, David Maus wrote:

> When non-nil, clones of a subtree don't inherit the ID property.
> Otherwise they do and it will be set to a new unique identifier.
> ---
> lisp/ChangeLog |    3 +++
> lisp/org.el    |   16 ++++++++++++++--
> 2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index ec2fa36..ba65761 100644
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -4,6 +4,9 @@
> 	when cache was cleared.
> 	(org-clone-subtree-with-time-shift): Maybe create ID property
> 	in cloned subtrees.
> +	(org-clone-delete-id): New customization variable.
> +	(org-clone-subtree-with-time-shift): Use customization
> +	variable `org-clone-delete-id'.
>
> 2010-05-17  Carsten Dominik  <carsten.dominik@gmail.com>
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 64da60a..88d636d 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -105,6 +105,13 @@
> (require 'org-footnote)
>
> ;;;; Customization variables
> +(defcustom org-clone-delete-id nil
> +  "Remove ID property of clones of a subtree.
> +When non-nil, clones of a subtree don't inherit the ID property.
> +Otherwise they inherit the ID property with a new unique
> +identifier."
> +  :type 'boolean
> +  :group 'org-id)
>
> ;;; Version
>
> @@ -7204,13 +7211,18 @@ and still retain the repeater to cover  
> future instances of the task."
> 			   (with-temp-buffer
> 			     (insert template)
> 			     (org-mode)
> -			     (org-id-get-create t)
> +			     (goto-char (point-min))
> +			     (if org-clone-delete-id
> +				 (org-entry-delete nil "ID")
> +			       (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))
> +	      (and idprop (if org-clone-delete-id
> +			      (org-entry-delete nil "ID")
> +			    (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
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] Provide customization variable `org-clone-delete-id'.
  2010-05-19 21:35   ` Carsten Dominik
@ 2010-05-20  5:48     ` David Maus
  0 siblings, 0 replies; 5+ messages in thread
From: David Maus @ 2010-05-20  5:48 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode Mode


[-- Attachment #1.1: Type: text/plain, Size: 243 bytes --]

Carsten Dominik wrote:
>Hi David, do you have these patches on a branch?

Arg, yes, of course:

git://github.com/dmj/dmj-org-mode.git quickfix

 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-20  5:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 3/3] Remove empty property drawers in cloned subtrees David Maus

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).