From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: Setting taskjuggler project start date (ox-taskjuggler) Date: Mon, 25 Mar 2013 02:17:02 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:44477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK1eT-0002fU-Dy for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 03:17:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UK1eR-0005LN-Sv for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 03:17:05 -0400 Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:49949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK1eR-0005L9-Gq for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 03:17:03 -0400 Received: by mail-la0-f43.google.com with SMTP id ek20so10741591lab.16 for ; Mon, 25 Mar 2013 00:17:02 -0700 (PDT) In-Reply-To: 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 On Mon, Mar 25, 2013 at 1:27 AM, John Hendy wrote: > Having trouble setting the project start date, which results in a > build error since my project started before today, and the default > project start appears to be today's date. This was with no > customization to the top level headline. Intuitively, I added a > :start: property like so: > > #+begin_src org > > * Project :taskjuggler_project: > :PROPERTIES: > :start: 2013-03-01 > :END: > > #+end_src > > This results in (no change from exporting with no :start: property: > > #+begin_src TJ > > project nil "Project" "1.0" 2013-03-25 +280d { > } > > #+end_src > > From digging around in ox-taskjuggler.el, it looks like the project > gets defined here: > > #+begin_src ox-taskjuggler.el (line 607) > > (defun org-taskjuggler--build-project (project info) > "Return a project declaration. > PROJECT is a headline. INFO is a plist used as a communication > channel. If no start date is specified, start today. If no end > date is specified, end `org-taskjuggler-default-project-duration' > days from now." > (format "project %s \"%s\" \"%s\" %s %s {\n}\n" > (org-taskjuggler-get-id project info) > (org-taskjuggler-get-name project) > ;; Version is obtained through :TASKJUGGLER_VERSION: > ;; property or `org-taskjuggler-default-project-version'. > (or (org-element-property :VERSION project) > org-taskjuggler-default-project-version) > (or (org-taskjuggler-get-start project) > (format-time-string "%Y-%m-%d")) > (let ((end (org-taskjuggler-get-end project))) > (or (and end (format "- %s" end)) > (format "+%sd" org-taskjuggler-default-project-duration)))))] > > #+end_src > > I'm no esliper, but I think I can track that the consecutive =%s= > arguments are replaced by the successive function calls. That, and > =org-taskjuggler-get-start project= looks like the ticket. That > function is here: > > #+begin_src ox-taskjuggler.el (line 372) > > (defun org-taskjuggler-get-start (item) > "Return start date for task or resource ITEM. > ITEM is a headline. Return value is a string or nil if ITEM > doesn't have any start date defined.." > (let ((scheduled (org-element-property :scheduled item))) > (and scheduled (org-timestamp-format scheduled "%Y-%02m-%02d")))) > > #+end_src > > So, that suggested that perhaps I needed to use :scheduled: instead of > :start:. I tried that with the same results. It appears that this > property /is/ applied at the task level for the top headline, however: > > #+begin_src TJ > > task project "Project" { > purge allocate > allocate jwhendy > start 2013-03-01 > ... > > } > > #+end_src > > So, it applies :start: to the top level project in the /task/ > definition area, but doesn't apply it to the very top level project > definition. > > Any suggestions? This works, though I know approximately nil (didja see what I did there) about elisp: #+begin_src ox-taskjuggler.el (defun org-taskjuggler--build-project (project info) "Return a project declaration. PROJECT is a headline. INFO is a plist used as a communication channel. If no start date is specified, start today. If no end date is specified, end `org-taskjuggler-default-project-duration' days from now." (format "project %s \"%s\" \"%s\" %s %s {\n}\n" (org-taskjuggler-get-id project info) (org-taskjuggler-get-name project) ;; Version is obtained through :TASKJUGGLER_VERSION: ;; property or `org-taskjuggler-default-project-version'. (or (org-element-property :VERSION project) org-taskjuggler-default-project-version) (or (org-element-property :START project) (format-time-string "%Y-%02m-%02d")) (let ((end (org-element-property :END project))) (or (and end (format "- %s" end)) (format "+%sd" org-taskjuggler-default-project-duration))))) #+end_src I don't know why the org-taskjuggler-get-start function works for the task definition and not the project definition... but just looking for the contents of the :start: and :end: properties directly is my current hack. I'll leave it like that just so I don't have to manually change the .tjp file at every export, but I'm sure there's a "proper" way to fix :) John > > > John