From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yann Hodique Subject: [PATCH v3 07/11] org-taskjuggler.el: Make project umbrella task optional Date: Thu, 16 Aug 2012 21:02:05 +0200 Message-ID: <1345143729-72705-8-git-send-email-yann.hodique@gmail.com> References: <1345057917-69300-1-git-send-email-yann.hodique@gmail.com> <1345143729-72705-1-git-send-email-yann.hodique@gmail.com> Return-path: Received: from eggs.gnu.org ([208.118.235.92]:48624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T25LE-0006hz-RH for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:02:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T25LD-0001rK-Pa for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:02:48 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:54011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T25LD-0001oK-KV for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:02:47 -0400 Received: by mail-we0-f169.google.com with SMTP id s10so2257402wey.0 for ; Thu, 16 Aug 2012 12:02:47 -0700 (PDT) In-Reply-To: <1345143729-72705-1-git-send-email-yann.hodique@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Yann Hodique * org-taskjuggler.el (org-export-taskjuggler-keep-project-as-task): Add new option. (org-export-as-taskjuggler): Optionally drop the topmost "task" (project). (org-taskjuggler-assign-task-ids): Adapt path computation by optionally dropping the topmost component (project). Introduce `org-export-taskjuggler-keep-project-as-task' as a flag to toggle the behavior. Keep old behavior as default. --- lisp/org-taskjuggler.el | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el index 7376302..3c97e03 100644 --- a/lisp/org-taskjuggler.el +++ b/lisp/org-taskjuggler.el @@ -264,6 +264,14 @@ but before any resource and task declarations." the corresponding resource." :group 'org-export-taskjuggler) +(defcustom org-export-taskjuggler-keep-project-as-task t + "Whether to keep the project headline as an umbrella task for + all declared tasks. Setting this to nil will allow maintaining + completely separated task buckets, while still sharing the same + resources pool." + :group 'org-export-taskjuggler + :type 'boolean) + ;;; Hooks (defvar org-export-taskjuggler-final-hook nil @@ -350,7 +358,10 @@ defined in `org-export-taskjuggler-default-reports'." (org-clone-local-variables old-buffer "^org-") (insert org-export-taskjuggler-default-global-header) - (org-taskjuggler-open-project (car tasks)) + (org-taskjuggler-open-project + (if org-export-taskjuggler-keep-project-as-task + (car tasks) + (pop tasks))) (insert org-export-taskjuggler-default-global-properties) (insert "\n") (dolist (resource resources) @@ -365,7 +376,9 @@ defined in `org-export-taskjuggler-default-reports'." (org-taskjuggler-close-maybe level) (org-taskjuggler-open-task task) (setq org-export-taskjuggler-old-level level))) - (org-taskjuggler-close-maybe 1) + (org-taskjuggler-close-maybe + (if org-export-taskjuggler-keep-project-as-task + 1 2)) (org-taskjuggler-insert-reports) (save-buffer) (or (org-export-push-to-kill-ring "TaskJuggler") @@ -446,7 +459,11 @@ a path to the current task." (push unique-id (car unique-ids)) (setcar path unique-id))) (push (cons "unique-id" unique-id) task) - (push (cons "path" (mapconcat 'identity (reverse path) ".")) task) + (push (cons "path" + (mapconcat 'identity + (if org-export-taskjuggler-keep-project-as-task + (reverse path) + (cdr (reverse path))) ".")) task) (setq previous-level level) (setq resolved-tasks (append resolved-tasks (list task))))))) -- 1.7.11.4