From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yann Hodique Subject: [PATCH 07/10] org-taskjuggler: make project umbrella task optional Date: Sun, 5 Aug 2012 12:54:01 +0200 Message-ID: <1344164044-15059-8-git-send-email-yann.hodique@gmail.com> References: <1344164044-15059-1-git-send-email-yann.hodique@gmail.com> Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxyUN-0001kE-GP for emacs-orgmode@gnu.org; Sun, 05 Aug 2012 06:55:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxyUM-00011X-FT for emacs-orgmode@gnu.org; Sun, 05 Aug 2012 06:55:15 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:40227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxyUM-0000yI-9A for emacs-orgmode@gnu.org; Sun, 05 Aug 2012 06:55:14 -0400 Received: by mail-wg0-f49.google.com with SMTP id ez12so1367573wgb.30 for ; Sun, 05 Aug 2012 03:55:13 -0700 (PDT) In-Reply-To: <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 introduce `org-export-taskjuggler-keep-project-as-task' as a flag to toggle the behavior. Keep old behavior as default. * 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) --- 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 92ba79c..996665d 100644 --- a/lisp/org-taskjuggler.el +++ b/lisp/org-taskjuggler.el @@ -263,6 +263,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 @@ -349,7 +357,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) @@ -364,7 +375,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") @@ -445,7 +458,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.3