emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 0/5] Improvements to Taskjuggler export
@ 2011-03-16 11:04 Christian Egli
  2011-03-16 11:04 ` [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3 Christian Egli
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Christian Egli @ 2011-03-16 11:04 UTC (permalink / raw)
  To: emacs-orgmode

Hi all

I have some long standing improvements to Taskjuggler export which I'd
finally like to push to the repo.

Thanks

Christian Egli (5):
  Add some minimal infrastructure to handle export to both tj2 and tj3
  Mark a task as a milestone if it is a leaf node and cannot be
    scheduled
  Replace recursive functions with iterative ones
  Remove a spurious debug statement
  Escape double quotes in headlines

 lisp/org-taskjuggler.el |   76 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 58 insertions(+), 18 deletions(-)

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

* [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3
  2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
@ 2011-03-16 11:04 ` Christian Egli
  2011-03-17  8:44   ` [Accepted] [O, " Bastien Guerry
  2011-03-17  8:59   ` [PATCH " Bastien
  2011-03-16 11:04 ` [PATCH 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled Christian Egli
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 20+ messages in thread
From: Christian Egli @ 2011-03-16 11:04 UTC (permalink / raw)
  To: emacs-orgmode

* org-taskjuggler.el (org-export-taskjuggler-target-version):
(org-taskjuggler-targeting-tj3-p): Add some minimal infrastructure to
handle export to both tj2 and tj3.
(org-taskjuggler-open-task): Use a different way to purge allocations
for tj2 and tj3.
---
 lisp/org-taskjuggler.el |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index 8d6318e..ec6bb30 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -181,6 +181,11 @@ resources for the project."
   :group 'org-export-taskjuggler
   :type 'string)
 
+(defcustom org-export-taskjuggler-target-version 2.4
+  "Which version of TaskJuggler the exporter is targeting."
+  :group 'org-export-taskjuggler
+  :type 'number)
+
 (defcustom org-export-taskjuggler-default-project-version "1.0"
   "Default version string for the project."
   :group 'org-export-taskjuggler
@@ -331,6 +336,10 @@ with the TaskJuggler GUI."
 	 (command (concat process-name " " file-name)))
     (start-process-shell-command process-name nil command)))
 
+(defun org-taskjuggler-targeting-tj3-p ()
+  "Return true if we are targeting TaskJuggler III."
+  (< org-export-taskjuggler-target-version 3.0))
+
 (defun org-taskjuggler-parent-is-ordered-p ()
   "Return true if the parent of the current node has a property
 \"ORDERED\". Return nil otherwise."
@@ -623,7 +632,10 @@ org-mode priority string."
       (if (and parent-ordered previous-sibling)
 	  (format " depends %s\n" previous-sibling)
 	(and depends (format " depends %s\n" depends)))
-      (and allocate (format " purge allocations\n allocate %s\n" allocate))
+      (and allocate (format " purge %s\n allocate %s\n"
+			    (or (and (org-taskjuggler-targeting-tj3-p) "allocations")
+				"allocate")
+			    allocate))
       (and complete (format " complete %s\n" complete))
       (and effort (format " effort %s\n" effort))
       (and priority (format " priority %s\n" priority))
-- 
1.7.1

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

* [PATCH 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled
  2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
  2011-03-16 11:04 ` [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3 Christian Egli
@ 2011-03-16 11:04 ` Christian Egli
  2011-03-17  8:45   ` [Accepted] [O, " Bastien Guerry
  2011-03-16 11:05 ` [PATCH 3/5] Replace recursive functions with iterative ones Christian Egli
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Christian Egli @ 2011-03-16 11:04 UTC (permalink / raw)
  To: emacs-orgmode

* org-taskjuggler.el (org-taskjuggler-compute-task-leafiness): Compute
the leafiness of a node.
(org-taskjuggler-open-task, org-export-as-taskjuggler): Mark a node as
a milestone if it is a leaf and has no effort.

Mark a task as a milestone if it has neither an effort, a duration, an
end or a period. This is needed for tj3 export as tj3 fails to compile
the file if there is a leaf node with no computable end date. tj2
happily ignored the situation, but TJ3 throws an error.
---
 lisp/org-taskjuggler.el |   37 +++++++++++++++++++++++++++++++------
 1 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index ec6bb30..2d16790 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -263,9 +263,10 @@ defined in `org-export-taskjuggler-default-reports'."
   (let* ((tasks
 	  (org-taskjuggler-resolve-dependencies
 	   (org-taskjuggler-assign-task-ids 
-	    (org-map-entries 
-	     '(org-taskjuggler-components) 
-	     org-export-taskjuggler-project-tag nil 'archive 'comment))))
+	    (org-taskjuggler-compute-task-leafiness
+	     (org-map-entries 
+	      '(org-taskjuggler-components) 
+	      org-export-taskjuggler-project-tag nil 'archive 'comment)))))
 	 (resources
 	  (org-taskjuggler-assign-resource-ids
 	   (org-map-entries 
@@ -392,6 +393,23 @@ a path to the current task."
 	(setq previous-level level)
 	(setq resolved-tasks (append resolved-tasks (list task)))))))
 
+(defun org-taskjuggler-compute-task-leafiness (tasks)
+  "Figure out if each task is a leaf by looking at it's level,
+and the level of its successor. If the successor is higher (ie
+deeper), then it's not a leaf."
+  (cond
+   ((null tasks) nil)
+   ;; if a task has no successors it is a leaf
+   ((null (car (cdr tasks)))
+    (cons (cons (cons "leaf-node" t) (car tasks)) 
+	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
+   ;; if the successor has a lower level than task it is a leaf
+   ((<= (cdr (assoc "level" (car (cdr tasks)))) (cdr (assoc "level" (car tasks)))) 
+    (cons (cons (cons "leaf-node" t) (car tasks)) 
+	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
+   ;; otherwise examine the rest of the tasks
+   (t (cons (car tasks) (org-taskjuggler-compute-task-leafiness (cdr tasks))))))
+
 (defun org-taskjuggler-assign-resource-ids (resources &optional unique-ids)
   "Given a list of resources return the same list, assigning a
 unique id to each resource."
@@ -621,11 +639,17 @@ org-mode priority string."
 		      (cdr (assoc "complete" task))))
 	(parent-ordered (cdr (assoc "parent-ordered" task)))
 	(previous-sibling (cdr (assoc "previous-sibling" task)))
+	(milestone (or (cdr (assoc "milestone" task))
+		       (and (assoc "leaf-node" task)
+			    (not (or effort 
+				     (cdr (assoc "duration" task))
+				     (cdr (assoc "end" task))
+				     (cdr (assoc "period" task)))))))
 	(attributes 
 	 '(account start note duration endbuffer endcredit end
-	   flags journalentry length maxend maxstart milestone
-	   minend minstart period reference responsible
-	   scheduling startbuffer startcredit statusnote)))
+	   flags journalentry length maxend maxstart minend
+	   minstart period reference responsible scheduling
+	   startbuffer startcredit statusnote)))
     (insert
      (concat 
       "task " unique-id " \"" headline "\" {\n" 
@@ -639,6 +663,7 @@ org-mode priority string."
       (and complete (format " complete %s\n" complete))
       (and effort (format " effort %s\n" effort))
       (and priority (format " priority %s\n" priority))
+      (and milestone (format " milestone\n"))
       
       (org-taskjuggler-get-attributes task attributes)
       "\n"))))
-- 
1.7.1

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

* [PATCH 3/5] Replace recursive functions with iterative ones
  2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
  2011-03-16 11:04 ` [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3 Christian Egli
  2011-03-16 11:04 ` [PATCH 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled Christian Egli
@ 2011-03-16 11:05 ` Christian Egli
  2011-03-16 11:05 ` [PATCH 4/5] Remove a spurious debug statement Christian Egli
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Christian Egli @ 2011-03-16 11:05 UTC (permalink / raw)
  To: emacs-orgmode

* org-taskjuggler.el (org-taskjuggler-compute-task-leafiness):
(org-taskjuggler-assign-resource-ids): Replace recursive
implementation with an iterative one.

That way we can avoid to have ask users to increase
`max-lisp-eval-depth'.
---
 lisp/org-taskjuggler.el |   48 ++++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index 2d16790..5b3f16f 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -397,31 +397,33 @@ a path to the current task."
   "Figure out if each task is a leaf by looking at it's level,
 and the level of its successor. If the successor is higher (ie
 deeper), then it's not a leaf."
-  (cond
-   ((null tasks) nil)
-   ;; if a task has no successors it is a leaf
-   ((null (car (cdr tasks)))
-    (cons (cons (cons "leaf-node" t) (car tasks)) 
-	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
-   ;; if the successor has a lower level than task it is a leaf
-   ((<= (cdr (assoc "level" (car (cdr tasks)))) (cdr (assoc "level" (car tasks)))) 
-    (cons (cons (cons "leaf-node" t) (car tasks)) 
-	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
-   ;; otherwise examine the rest of the tasks
-   (t (cons (car tasks) (org-taskjuggler-compute-task-leafiness (cdr tasks))))))
-
-(defun org-taskjuggler-assign-resource-ids (resources &optional unique-ids)
+  (let (new-list)
+    (while (car tasks)
+      (let ((task (car tasks))
+	    (successor (car (cdr tasks))))
+	(cond
+	 ;; if a task has no successors it is a leaf
+	 ((null successor) 
+	  (push (cons (cons "leaf-node" t) task) new-list))
+	 ;; if the successor has a lower level than task it is a leaf
+	 ((<= (cdr (assoc "level" successor)) (cdr (assoc "level" task))) 
+	  (push (cons (cons "leaf-node" t) task) new-list))
+	 ;; otherwise examine the rest of the tasks
+	 (t (push task new-list))))
+      (setq tasks (cdr tasks)))
+    (print new-list)
+    (nreverse new-list)))
+
+(defun org-taskjuggler-assign-resource-ids (resources)
   "Given a list of resources return the same list, assigning a
 unique id to each resource."
-  (cond
-   ((null resources) nil)
-   (t 
-    (let* ((resource (car resources))
-	   (unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
-      (push (cons "unique-id" unique-id) resource)
-      (cons resource 
-	    (org-taskjuggler-assign-resource-ids (cdr resources) 
-						 (cons unique-id unique-ids)))))))
+  (let (unique-ids new-list)
+    (dolist (resource resources new-list)
+      (let ((unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
+	(push (cons "unique-id" unique-id) resource)
+	(push unique-id unique-ids)
+	(push resource new-list)))
+    (nreverse new-list)))
 
 (defun org-taskjuggler-resolve-dependencies (tasks)
   (let ((previous-level 0)
-- 
1.7.1

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

* [PATCH 4/5] Remove a spurious debug statement
  2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
                   ` (2 preceding siblings ...)
  2011-03-16 11:05 ` [PATCH 3/5] Replace recursive functions with iterative ones Christian Egli
@ 2011-03-16 11:05 ` Christian Egli
  2011-03-16 11:05 ` [PATCH 5/5] Escape double quotes in headlines Christian Egli
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Christian Egli @ 2011-03-16 11:05 UTC (permalink / raw)
  To: emacs-orgmode

* org-taskjuggler.el (org-taskjuggler-compute-task-leafiness): Remove
a debug statement.
---
 lisp/org-taskjuggler.el |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index 5b3f16f..b39353c 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -411,7 +411,6 @@ deeper), then it's not a leaf."
 	 ;; otherwise examine the rest of the tasks
 	 (t (push task new-list))))
       (setq tasks (cdr tasks)))
-    (print new-list)
     (nreverse new-list)))
 
 (defun org-taskjuggler-assign-resource-ids (resources)
-- 
1.7.1

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

* [PATCH 5/5] Escape double quotes in headlines
  2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
                   ` (3 preceding siblings ...)
  2011-03-16 11:05 ` [PATCH 4/5] Remove a spurious debug statement Christian Egli
@ 2011-03-16 11:05 ` Christian Egli
  2011-03-17  8:49   ` [Accepted] [O,5/5] " Bastien Guerry
  2011-03-16 20:33 ` [PATCH 0/5] Improvements to Taskjuggler export Marc-Oliver Ihm
  2011-03-17  8:56 ` Bastien
  6 siblings, 1 reply; 20+ messages in thread
From: Christian Egli @ 2011-03-16 11:05 UTC (permalink / raw)
  To: emacs-orgmode

* org-taskjuggler.el (org-taskjuggler-components): Escape quotes in
headlines.

Taskjuggler will barf if the task names (which are double quoted
strings) contain double quotes.
---
 lisp/org-taskjuggler.el |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index b39353c..ed3af48 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -354,7 +354,9 @@ information, all the properties, etc."
   (let* ((props (org-entry-properties))
 	 (components (org-heading-components))
 	 (level (nth 1 components))
-	 (headline (nth 4 components))
+	 (headline 
+	  (replace-regexp-in-string 
+	   "\"" "\\\"" (nth 4 components) t t)) ; quote double quotes in headlines
 	 (parent-ordered (org-taskjuggler-parent-is-ordered-p)))
     (push (cons "level" level) props)
     (push (cons "headline" headline) props)
-- 
1.7.1

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

* Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
                   ` (4 preceding siblings ...)
  2011-03-16 11:05 ` [PATCH 5/5] Escape double quotes in headlines Christian Egli
@ 2011-03-16 20:33 ` Marc-Oliver Ihm
  2011-03-17  8:57   ` Bastien
  2011-03-17 20:46   ` Christian Egli
  2011-03-17  8:56 ` Bastien
  6 siblings, 2 replies; 20+ messages in thread
From: Marc-Oliver Ihm @ 2011-03-16 20:33 UTC (permalink / raw)
  To: Christian Egli; +Cc: emacs-orgmode

Hello Christian,

Great news !

I am using your wonderful exporter with the extensions from Anthony Lander.
The exporter connects two great tools: Org and taskjuggler and I like it 
very much. Thanx a lot for this work !

Two questions however:

Does your fork incorporate Anthonys enhancements (e.g. the :TJ:-Drawer) ?
Is it available at your github (https://github.com/egli/org-mode) ?


with kind regards, Marc-Oliver Ihm


Am 16.03.2011 12:04, schrieb Christian Egli:
> Hi all
>
> I have some long standing improvements to Taskjuggler export which I'd
> finally like to push to the repo.
>
> Thanks
>
> Christian Egli (5):
>    Add some minimal infrastructure to handle export to both tj2 and tj3
>    Mark a task as a milestone if it is a leaf node and cannot be
>      scheduled
>    Replace recursive functions with iterative ones
>    Remove a spurious debug statement
>    Escape double quotes in headlines
>
>   lisp/org-taskjuggler.el |   76 +++++++++++++++++++++++++++++++++++-----------
>   1 files changed, 58 insertions(+), 18 deletions(-)
>
>
>

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

* [Accepted] [O, 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3
  2011-03-16 11:04 ` [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3 Christian Egli
@ 2011-03-17  8:44   ` Bastien Guerry
  2011-03-17  8:59   ` [PATCH " Bastien
  1 sibling, 0 replies; 20+ messages in thread
From: Bastien Guerry @ 2011-03-17  8:44 UTC (permalink / raw)
  To: emacs-orgmode

Patch 691 (http://patchwork.newartisans.com/patch/691/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1300273502-12977-2-git-send-email-christian.egli%40alumni.ethz.ch%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O,
> 	1/5] Add some minimal infrastructure to handle export to both tj2 and
> 	tj3
> Date: Wed, 16 Mar 2011 16:04:58 -0000
> From: Christian Egli <christian.egli@alumni.ethz.ch>
> X-Patchwork-Id: 691
> Message-Id: <1300273502-12977-2-git-send-email-christian.egli@alumni.ethz.ch>
> To: emacs-orgmode@gnu.org
> 
> * org-taskjuggler.el (org-export-taskjuggler-target-version):
> (org-taskjuggler-targeting-tj3-p): Add some minimal infrastructure to
> handle export to both tj2 and tj3.
> (org-taskjuggler-open-task): Use a different way to purge allocations
> for tj2 and tj3.
> 
> ---
> lisp/org-taskjuggler.el |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
> index 8d6318e..ec6bb30 100644
> --- a/lisp/org-taskjuggler.el
> +++ b/lisp/org-taskjuggler.el
> @@ -181,6 +181,11 @@ resources for the project."
>    :group 'org-export-taskjuggler
>    :type 'string)
>  
> +(defcustom org-export-taskjuggler-target-version 2.4
> +  "Which version of TaskJuggler the exporter is targeting."
> +  :group 'org-export-taskjuggler
> +  :type 'number)
> +
>  (defcustom org-export-taskjuggler-default-project-version "1.0"
>    "Default version string for the project."
>    :group 'org-export-taskjuggler
> @@ -331,6 +336,10 @@ with the TaskJuggler GUI."
>  	 (command (concat process-name " " file-name)))
>      (start-process-shell-command process-name nil command)))
>  
> +(defun org-taskjuggler-targeting-tj3-p ()
> +  "Return true if we are targeting TaskJuggler III."
> +  (< org-export-taskjuggler-target-version 3.0))
> +
>  (defun org-taskjuggler-parent-is-ordered-p ()
>    "Return true if the parent of the current node has a property
>  \"ORDERED\". Return nil otherwise."
> @@ -623,7 +632,10 @@ org-mode priority string."
>        (if (and parent-ordered previous-sibling)
>  	  (format " depends %s\n" previous-sibling)
>  	(and depends (format " depends %s\n" depends)))
> -      (and allocate (format " purge allocations\n allocate %s\n" allocate))
> +      (and allocate (format " purge %s\n allocate %s\n"
> +			    (or (and (org-taskjuggler-targeting-tj3-p) "allocations")
> +				"allocate")
> +			    allocate))
>        (and complete (format " complete %s\n" complete))
>        (and effort (format " effort %s\n" effort))
>        (and priority (format " priority %s\n" priority))
> 

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

* [Accepted] [O, 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled
  2011-03-16 11:04 ` [PATCH 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled Christian Egli
@ 2011-03-17  8:45   ` Bastien Guerry
  0 siblings, 0 replies; 20+ messages in thread
From: Bastien Guerry @ 2011-03-17  8:45 UTC (permalink / raw)
  To: emacs-orgmode

Patch 695 (http://patchwork.newartisans.com/patch/695/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1300273502-12977-3-git-send-email-christian.egli%40alumni.ethz.ch%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O, 2/5] Mark a task as a milestone if it is a leaf node and cannot be
> 	scheduled
> Date: Wed, 16 Mar 2011 16:04:59 -0000
> From: Christian Egli <christian.egli@alumni.ethz.ch>
> X-Patchwork-Id: 695
> Message-Id: <1300273502-12977-3-git-send-email-christian.egli@alumni.ethz.ch>
> To: emacs-orgmode@gnu.org
> 
> * org-taskjuggler.el (org-taskjuggler-compute-task-leafiness): Compute
> the leafiness of a node.
> (org-taskjuggler-open-task, org-export-as-taskjuggler): Mark a node as
> a milestone if it is a leaf and has no effort.
> 
> Mark a task as a milestone if it has neither an effort, a duration, an
> end or a period. This is needed for tj3 export as tj3 fails to compile
> the file if there is a leaf node with no computable end date. tj2
> happily ignored the situation, but TJ3 throws an error.
> 
> ---
> lisp/org-taskjuggler.el |   37 +++++++++++++++++++++++++++++++------
>  1 files changed, 31 insertions(+), 6 deletions(-)
> 
> diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
> index ec6bb30..2d16790 100644
> --- a/lisp/org-taskjuggler.el
> +++ b/lisp/org-taskjuggler.el
> @@ -263,9 +263,10 @@ defined in `org-export-taskjuggler-default-reports'."
>    (let* ((tasks
>  	  (org-taskjuggler-resolve-dependencies
>  	   (org-taskjuggler-assign-task-ids 
> -	    (org-map-entries 
> -	     '(org-taskjuggler-components) 
> -	     org-export-taskjuggler-project-tag nil 'archive 'comment))))
> +	    (org-taskjuggler-compute-task-leafiness
> +	     (org-map-entries 
> +	      '(org-taskjuggler-components) 
> +	      org-export-taskjuggler-project-tag nil 'archive 'comment)))))
>  	 (resources
>  	  (org-taskjuggler-assign-resource-ids
>  	   (org-map-entries 
> @@ -392,6 +393,23 @@ a path to the current task."
>  	(setq previous-level level)
>  	(setq resolved-tasks (append resolved-tasks (list task)))))))
>  
> +(defun org-taskjuggler-compute-task-leafiness (tasks)
> +  "Figure out if each task is a leaf by looking at it's level,
> +and the level of its successor. If the successor is higher (ie
> +deeper), then it's not a leaf."
> +  (cond
> +   ((null tasks) nil)
> +   ;; if a task has no successors it is a leaf
> +   ((null (car (cdr tasks)))
> +    (cons (cons (cons "leaf-node" t) (car tasks)) 
> +	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
> +   ;; if the successor has a lower level than task it is a leaf
> +   ((<= (cdr (assoc "level" (car (cdr tasks)))) (cdr (assoc "level" (car tasks)))) 
> +    (cons (cons (cons "leaf-node" t) (car tasks)) 
> +	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
> +   ;; otherwise examine the rest of the tasks
> +   (t (cons (car tasks) (org-taskjuggler-compute-task-leafiness (cdr tasks))))))
> +
>  (defun org-taskjuggler-assign-resource-ids (resources &optional unique-ids)
>    "Given a list of resources return the same list, assigning a
>  unique id to each resource."
> @@ -621,11 +639,17 @@ org-mode priority string."
>  		      (cdr (assoc "complete" task))))
>  	(parent-ordered (cdr (assoc "parent-ordered" task)))
>  	(previous-sibling (cdr (assoc "previous-sibling" task)))
> +	(milestone (or (cdr (assoc "milestone" task))
> +		       (and (assoc "leaf-node" task)
> +			    (not (or effort 
> +				     (cdr (assoc "duration" task))
> +				     (cdr (assoc "end" task))
> +				     (cdr (assoc "period" task)))))))
>  	(attributes 
>  	 '(account start note duration endbuffer endcredit end
> -	   flags journalentry length maxend maxstart milestone
> -	   minend minstart period reference responsible
> -	   scheduling startbuffer startcredit statusnote)))
> +	   flags journalentry length maxend maxstart minend
> +	   minstart period reference responsible scheduling
> +	   startbuffer startcredit statusnote)))
>      (insert
>       (concat 
>        "task " unique-id " \"" headline "\" {\n" 
> @@ -639,6 +663,7 @@ org-mode priority string."
>        (and complete (format " complete %s\n" complete))
>        (and effort (format " effort %s\n" effort))
>        (and priority (format " priority %s\n" priority))
> +      (and milestone (format " milestone\n"))
>        
>        (org-taskjuggler-get-attributes task attributes)
>        "\n"))))
> 

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

* [Accepted] [O,5/5] Escape double quotes in headlines
  2011-03-16 11:05 ` [PATCH 5/5] Escape double quotes in headlines Christian Egli
@ 2011-03-17  8:49   ` Bastien Guerry
  0 siblings, 0 replies; 20+ messages in thread
From: Bastien Guerry @ 2011-03-17  8:49 UTC (permalink / raw)
  To: emacs-orgmode

Patch 692 (http://patchwork.newartisans.com/patch/692/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1300273502-12977-6-git-send-email-christian.egli%40alumni.ethz.ch%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O,5/5] Escape double quotes in headlines
> Date: Wed, 16 Mar 2011 16:05:02 -0000
> From: Christian Egli <christian.egli@alumni.ethz.ch>
> X-Patchwork-Id: 692
> Message-Id: <1300273502-12977-6-git-send-email-christian.egli@alumni.ethz.ch>
> To: emacs-orgmode@gnu.org
> 
> * org-taskjuggler.el (org-taskjuggler-components): Escape quotes in
> headlines.
> 
> Taskjuggler will barf if the task names (which are double quoted
> strings) contain double quotes.
> 
> ---
> lisp/org-taskjuggler.el |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
> index b39353c..ed3af48 100644
> --- a/lisp/org-taskjuggler.el
> +++ b/lisp/org-taskjuggler.el
> @@ -354,7 +354,9 @@ information, all the properties, etc."
>    (let* ((props (org-entry-properties))
>  	 (components (org-heading-components))
>  	 (level (nth 1 components))
> -	 (headline (nth 4 components))
> +	 (headline 
> +	  (replace-regexp-in-string 
> +	   "\"" "\\\"" (nth 4 components) t t)) ; quote double quotes in headlines
>  	 (parent-ordered (org-taskjuggler-parent-is-ordered-p)))
>      (push (cons "level" level) props)
>      (push (cons "headline" headline) props)
> 

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

* Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
                   ` (5 preceding siblings ...)
  2011-03-16 20:33 ` [PATCH 0/5] Improvements to Taskjuggler export Marc-Oliver Ihm
@ 2011-03-17  8:56 ` Bastien
  2011-03-17 10:42   ` Christian Egli
  2011-03-18  7:54   ` Christian Egli
  6 siblings, 2 replies; 20+ messages in thread
From: Bastien @ 2011-03-17  8:56 UTC (permalink / raw)
  To: Christian Egli; +Cc: emacs-orgmode

Hi Christian,

Christian Egli <christian.egli@alumni.ethz.ch> writes:

> I have some long standing improvements to Taskjuggler export which I'd
> finally like to push to the repo.

this is great -- thanks a lot for the patches.  

I'm myself using TJ for some reports and I've had to hack things 
around when we had this compatibility problem.

Ps: I had trouble applying your patches: they came in one order on the
list, and on a different one on patchwork.  Applying them from patchwork
didn't always work, so I had to do a few things manually.  Not a problem.

-- 
 Bastien

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

* Re: Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-16 20:33 ` [PATCH 0/5] Improvements to Taskjuggler export Marc-Oliver Ihm
@ 2011-03-17  8:57   ` Bastien
  2011-03-17 20:47     ` Christian Egli
  2011-03-17 20:46   ` Christian Egli
  1 sibling, 1 reply; 20+ messages in thread
From: Bastien @ 2011-03-17  8:57 UTC (permalink / raw)
  To: Marc-Oliver Ihm; +Cc: Christian Egli, emacs-orgmode

Hi Marc-Oliver,

Marc-Oliver Ihm <marc-oliver.ihm@online.de> writes:

> Does your fork incorporate Anthonys enhancements (e.g. the
> :TJ:-Drawer) ?

Did Anthony advertized his enhancements on this list?  That's the 
place where to announce them, so that people won't miss them...

Best,

-- 
 Bastien

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

* Re: [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3
  2011-03-16 11:04 ` [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3 Christian Egli
  2011-03-17  8:44   ` [Accepted] [O, " Bastien Guerry
@ 2011-03-17  8:59   ` Bastien
  2011-03-17 10:39     ` Christian Egli
  1 sibling, 1 reply; 20+ messages in thread
From: Bastien @ 2011-03-17  8:59 UTC (permalink / raw)
  To: Christian Egli; +Cc: emacs-orgmode

Christian Egli <christian.egli@alumni.ethz.ch> writes:

> +(defun org-taskjuggler-targeting-tj3-p ()
> +  "Return true if we are targeting TaskJuggler III."
> +  (< org-export-taskjuggler-target-version 3.0))

I'm dubious on this one.

Shouldn't it be 

#+begin_src emacs-lisp
(defun org-taskjuggler-targeting-tj3-p ()
  "Return true if we are targeting TaskJuggler III."
  (> org-export-taskjuggler-target-version 3.0))
#+end

?

-- 
 Bastien

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

* Re: [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3
  2011-03-17  8:59   ` [PATCH " Bastien
@ 2011-03-17 10:39     ` Christian Egli
  2011-03-17 10:56       ` Bastien
  0 siblings, 1 reply; 20+ messages in thread
From: Christian Egli @ 2011-03-17 10:39 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Christian Egli <christian.egli@alumni.ethz.ch> writes:
>
>> +(defun org-taskjuggler-targeting-tj3-p ()
>> +  "Return true if we are targeting TaskJuggler III."
>> +  (< org-export-taskjuggler-target-version 3.0))
>
> I'm dubious on this one.
>
> Shouldn't it be 
>
> #+begin_src emacs-lisp
> (defun org-taskjuggler-targeting-tj3-p ()
>   "Return true if we are targeting TaskJuggler III."
>   (> org-export-taskjuggler-target-version 3.0))
> #+end
>
> ?

Basically org-export-taskjuggler-target-version can be 2.4 or 3.0. So
org-taskjuggler-targeting-tj3-p should return true if
org-export-taskjuggler-target-version is 3.0 or higher and false
otherwise.

So, let's see what the *scratch* buffer has to say about this

#+begin_src emacs-lisp
(setq org-export-taskjuggler-target-version 2.4)
2.4
(defun org-taskjuggler-targeting-tj3-p ()
  "Return true if we are targeting TaskJuggler III."
  (> org-export-taskjuggler-target-version 3.0))
org-taskjuggler-targeting-tj3-p
(org-taskjuggler-targeting-tj3-p)
nil
(setq org-export-taskjuggler-target-version 3.0)
3.0
(org-taskjuggler-targeting-tj3-p)
nil
(setq org-export-taskjuggler-target-version 3.1)
3.1
(org-taskjuggler-targeting-tj3-p)
t
#+end

Ah, you're right. There is a problem :-\.

The correct version should be 

#+begin_src emacs-lisp
(defun org-taskjuggler-targeting-tj3-p ()
  "Return true if we are targeting TaskJuggler III."
  (>= org-export-taskjuggler-target-version 3.0))
#+end

Let's test this in *scratch*
#+begin_src emacs-lisp
(setq org-export-taskjuggler-target-version 2.4)
2.4

(defun org-taskjuggler-targeting-tj3-p ()
  "Return true if we are targeting TaskJuggler III."
  (>= org-export-taskjuggler-target-version 3.0))
org-taskjuggler-targeting-tj3-p

(org-taskjuggler-targeting-tj3-p)
nil

(setq org-export-taskjuggler-target-version 3.0)
3.0

(org-taskjuggler-targeting-tj3-p)
t

(setq org-export-taskjuggler-target-version 3.1)
3.1

(org-taskjuggler-targeting-tj3-p)
t
#+end

How do we proceed? Do I resubmit the patch?

Thanks
Christian
-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

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

* Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-17  8:56 ` Bastien
@ 2011-03-17 10:42   ` Christian Egli
  2011-03-17 10:58     ` Bastien
  2011-03-18  7:54   ` Christian Egli
  1 sibling, 1 reply; 20+ messages in thread
From: Christian Egli @ 2011-03-17 10:42 UTC (permalink / raw)
  To: emacs-orgmode

Hi Bastien

Bastien <bzg@altern.org> writes:

> Ps: I had trouble applying your patches: they came in one order on the
> list, and on a different one on patchwork.  Applying them from patchwork
> didn't always work, so I had to do a few things manually.  Not a problem.

Is there anything I can do about this? I just commited the changes
locally and used git format-patch and git send-email.

Thanks
Christian

-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

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

* Re: Re: [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3
  2011-03-17 10:39     ` Christian Egli
@ 2011-03-17 10:56       ` Bastien
  0 siblings, 0 replies; 20+ messages in thread
From: Bastien @ 2011-03-17 10:56 UTC (permalink / raw)
  To: Christian Egli; +Cc: emacs-orgmode

Hi Christian,

Christian Egli <christian.egli@sbs.ch> writes:

> How do we proceed? Do I resubmit the patch?

No need, I just applied the fix you suggest.  Thanks for it!

-- 
 Bastien

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

* Re: Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-17 10:42   ` Christian Egli
@ 2011-03-17 10:58     ` Bastien
  0 siblings, 0 replies; 20+ messages in thread
From: Bastien @ 2011-03-17 10:58 UTC (permalink / raw)
  To: Christian Egli; +Cc: emacs-orgmode

Hi Christian,

Christian Egli <christian.egli@sbs.ch> writes:

> Bastien <bzg@altern.org> writes:
>
>> Ps: I had trouble applying your patches: they came in one order on the
>> list, and on a different one on patchwork.  Applying them from patchwork
>> didn't always work, so I had to do a few things manually.  Not a problem.
>
> Is there anything I can do about this?

I don't think so.  I'll investigate deeper if I see this problem again.

Thanks,

-- 
 Bastien

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

* Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-16 20:33 ` [PATCH 0/5] Improvements to Taskjuggler export Marc-Oliver Ihm
  2011-03-17  8:57   ` Bastien
@ 2011-03-17 20:46   ` Christian Egli
  1 sibling, 0 replies; 20+ messages in thread
From: Christian Egli @ 2011-03-17 20:46 UTC (permalink / raw)
  To: emacs-orgmode

Hi Marc

Marc-Oliver Ihm <marc-oliver.ihm@online.de> writes:

> Does your fork incorporate Anthonys enhancements (e.g. the
> :TJ:-Drawer) ?

It contains some of his enhancements but not all. He has two versions of
the code. One for tj2 and one for tj3. I would like to have one version
for both. The code as it stands right now can export a project for both
tj2 and tj3. However the way the defaults are set for the reports now
(in defcustom variables) it will not work for tj3. You'll have to
redefine the variables via M-x customize.

If you look at his code you'll see that he has some other enhancements.
There is support for project specific definitions, for global
definitions (such as shifts, etc) and for flags. One really nice idea is
that he added support for Drawers that can contain taskjuggler specific
code that is tied to a specific node. However I would like to implement
this as a src block, which would probably also cover global definitions
and file specific reports. My initial idea was to use something like
#+BEGIN_TASKJUGGLER and #+END_TASKJUGGLER. But nowadays it seems more
kosher to use something along the line of #+BEGIN_SRC taskjuggler. I
don't know what that would entail though. I might have to write a Babel
backend for Taskjuggler. I basically just want to use these code blocks
in my exporter.

> Is it available at your github (https://github.com/egli/org-mode) ?

No, this is stale (I should probably remove it). My most up to date code
should be in the orgmode repo.

Thanks
Christian
-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

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

* Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-17  8:57   ` Bastien
@ 2011-03-17 20:47     ` Christian Egli
  0 siblings, 0 replies; 20+ messages in thread
From: Christian Egli @ 2011-03-17 20:47 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Did Anthony advertized his enhancements on this list?

AFAIK he did announce them here, but that was a long time ago, probably
more than six months.

Thanks

-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

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

* Re: [PATCH 0/5] Improvements to Taskjuggler export
  2011-03-17  8:56 ` Bastien
  2011-03-17 10:42   ` Christian Egli
@ 2011-03-18  7:54   ` Christian Egli
  1 sibling, 0 replies; 20+ messages in thread
From: Christian Egli @ 2011-03-18  7:54 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> I'm myself using TJ for some reports and I've had to hack things 
> around when we had this compatibility problem.

I almost forgot to ask: What where the problems you had to hack around?

Thanks
Christian

-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

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

end of thread, other threads:[~2011-03-18  7:54 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
2011-03-16 11:04 ` [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3 Christian Egli
2011-03-17  8:44   ` [Accepted] [O, " Bastien Guerry
2011-03-17  8:59   ` [PATCH " Bastien
2011-03-17 10:39     ` Christian Egli
2011-03-17 10:56       ` Bastien
2011-03-16 11:04 ` [PATCH 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled Christian Egli
2011-03-17  8:45   ` [Accepted] [O, " Bastien Guerry
2011-03-16 11:05 ` [PATCH 3/5] Replace recursive functions with iterative ones Christian Egli
2011-03-16 11:05 ` [PATCH 4/5] Remove a spurious debug statement Christian Egli
2011-03-16 11:05 ` [PATCH 5/5] Escape double quotes in headlines Christian Egli
2011-03-17  8:49   ` [Accepted] [O,5/5] " Bastien Guerry
2011-03-16 20:33 ` [PATCH 0/5] Improvements to Taskjuggler export Marc-Oliver Ihm
2011-03-17  8:57   ` Bastien
2011-03-17 20:47     ` Christian Egli
2011-03-17 20:46   ` Christian Egli
2011-03-17  8:56 ` Bastien
2011-03-17 10:42   ` Christian Egli
2011-03-17 10:58     ` Bastien
2011-03-18  7:54   ` Christian Egli

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