From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yann Hodique Subject: [PATCH v2 07/11] org-taskjuggler: make project umbrella task optional Date: Wed, 15 Aug 2012 21:11:53 +0200 Message-ID: <1345057917-69300-9-git-send-email-yann.hodique@gmail.com> References: <1345057917-69300-1-git-send-email-yann.hodique@gmail.com> Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1j13-0004ry-1B for emacs-orgmode@gnu.org; Wed, 15 Aug 2012 15:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1j11-0002bT-Jq for emacs-orgmode@gnu.org; Wed, 15 Aug 2012 15:12:28 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:55156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1j11-0002an-E4 for emacs-orgmode@gnu.org; Wed, 15 Aug 2012 15:12:27 -0400 Received: by mail-wi0-f177.google.com with SMTP id hn17so1402754wib.12 for ; Wed, 15 Aug 2012 12:12:27 -0700 (PDT) In-Reply-To: <1345057917-69300-1-git-send-email-yann.hodique@gmail.com> In-Reply-To: <1344164044-15059-1-git-send-email-yann.hodique@gmail.com> References: <1344164044-15059-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): new custom variable (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