From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Item task_id not being used in taskjuggler export Date: Mon, 01 Apr 2013 16:21:28 +0200 Message-ID: <87eheutjpz.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:36412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMfcB-00065s-RY for emacs-orgmode@gnu.org; Mon, 01 Apr 2013 10:21:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMfc6-0003TL-VE for emacs-orgmode@gnu.org; Mon, 01 Apr 2013 10:21:39 -0400 Received: from mail-wg0-f54.google.com ([74.125.82.54]:41273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMfc6-0003T3-Oe for emacs-orgmode@gnu.org; Mon, 01 Apr 2013 10:21:34 -0400 Received: by mail-wg0-f54.google.com with SMTP id a12so2082849wgh.21 for ; Mon, 01 Apr 2013 07:21:33 -0700 (PDT) In-Reply-To: (John Hendy's message of "Sun, 31 Mar 2013 19:04:53 -0500") 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: John Hendy Cc: emacs-orgmode --=-=-= Content-Type: text/plain Hello, John Hendy writes: > I seem to be having trouble getting custom task_id values used for my > taskjuggler file. Thank you for the detailed report. Would the attached patch fix the problem? Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ox-taskjuggler-Use-task_id-property-when-specified.patch >From 30b8328292fc09b3f1ae84b469d1c574c19bfa58 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 1 Apr 2013 16:08:37 +0200 Subject: [PATCH] ox-taskjuggler: Use task_id property when specified * contrib/lisp/ox-taskjuggler.el (org-taskjuggler--build-unique-id): Use specified id (TASK_ID property) when possible. --- contrib/lisp/ox-taskjuggler.el | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el index cdc9195..5b2e5cc 100644 --- a/contrib/lisp/ox-taskjuggler.el +++ b/contrib/lisp/ox-taskjuggler.el @@ -411,16 +411,19 @@ resource. Its id is derived from its name and made unique against UNIQUE-IDS. If the (downcased) first token of the headline is not unique try to add more (downcased) tokens of the headline or finally add more underscore characters (\"_\")." - (let* ((parts (org-split-string (org-element-property :raw-value item))) - (id (org-taskjuggler--clean-id (downcase (pop parts))))) - ;; Try to add more parts of the headline to make it unique. - (while (and (car parts) (member id unique-ids)) - (setq id (concat id "_" - (org-taskjuggler--clean-id (downcase (pop parts)))))) - ;; If it's still not unique, add "_". - (while (member id unique-ids) - (setq id (concat id "_"))) - id)) + (let ((id (org-string-nw-p (org-element-property :TASK_ID item)))) + ;; If an id is specified, use it, as long as it's unique. + (if (not (member id unique-ids)) id + (let* ((parts (org-split-string (org-element-property :raw-value item))) + (id (org-taskjuggler--clean-id (downcase (pop parts))))) + ;; Try to add more parts of the headline to make it unique. + (while (and (car parts) (member id unique-ids)) + (setq id (concat id "_" + (org-taskjuggler--clean-id (downcase (pop parts)))))) + ;; If it's still not unique, add "_". + (while (member id unique-ids) + (setq id (concat id "_"))) + id)))) (defun org-taskjuggler--clean-id (id) "Clean and return ID to make it acceptable for TaskJuggler. -- 1.8.2 --=-=-=--