From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yann Hodique Subject: [PATCH v3 05/11] org-taskjuggler.el: Introduce a global header, for early macros Date: Thu, 16 Aug 2012 21:02:03 +0200 Message-ID: <1345143729-72705-6-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]:48550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T25LB-0006YO-Kc for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:02:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T25LA-0001pr-DH for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:02:45 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:53620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T25LA-0001nq-72 for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:02:44 -0400 Received: by mail-wg0-f49.google.com with SMTP id ez12so2171108wgb.30 for ; Thu, 16 Aug 2012 12:02:43 -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-default-global-header): Add new option. (org-export-as-taskjuggler): Insert global header before anything else. --- lisp/org-taskjuggler.el | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el index a18cdf8..c997da7 100644 --- a/lisp/org-taskjuggler.el +++ b/lisp/org-taskjuggler.el @@ -221,6 +221,14 @@ with `org-export-taskjuggler-project-tag'" :version "24.1" :type '(repeat (string :tag "Report"))) +(defcustom org-export-taskjuggler-default-global-header + "" + "Default global header for the project. This goes before +project declaration, and might be useful for early macros" + :group 'org-export-taskjuggler + :version "24.1" + :type '(string :tag "Preamble")) + (defcustom org-export-taskjuggler-default-global-properties "shift s40 \"Part time shift\" { workinghours wed, thu, fri off @@ -332,11 +340,6 @@ defined in `org-export-taskjuggler-default-reports'." (setcar tasks (push (cons "version" version) task)))) (with-current-buffer buffer (erase-buffer) - (org-clone-local-variables old-buffer "^org-") - (org-taskjuggler-open-project (car tasks)) - (insert org-export-taskjuggler-default-global-properties) - (insert "\n") - (dolist (resource resources) (org-install-letbind) ;; create local variables for all options, to make sure all called ;; functions get the correct information @@ -345,6 +348,12 @@ defined in `org-export-taskjuggler-default-reports'." (plist-get opt-plist (car x)))) org-export-plist-vars) + (org-clone-local-variables old-buffer "^org-") + (insert org-export-taskjuggler-default-global-header) + (org-taskjuggler-open-project (car tasks)) + (insert org-export-taskjuggler-default-global-properties) + (insert "\n") + (dolist (resource resources) (let ((level (cdr (assoc "level" resource)))) (org-taskjuggler-close-maybe level) (org-taskjuggler-open-resource resource) -- 1.7.11.4