emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: John Hendy <jw.hendy@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Item task_id not being used in taskjuggler export
Date: Mon, 01 Apr 2013 16:21:28 +0200	[thread overview]
Message-ID: <87eheutjpz.fsf@gmail.com> (raw)
In-Reply-To: <CA+M2ft8ieD0wm4_fd5s7KMt3wT5ES+6hpn+2ho7dwEEYQLYJBA@mail.gmail.com> (John Hendy's message of "Sun, 31 Mar 2013 19:04:53 -0500")

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

Hello,

John Hendy <jw.hendy@gmail.com> 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-taskjuggler-Use-task_id-property-when-specified.patch --]
[-- Type: text/x-patch, Size: 2142 bytes --]

From 30b8328292fc09b3f1ae84b469d1c574c19bfa58 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
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


  parent reply	other threads:[~2013-04-01 14:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01  0:04 Item task_id not being used in taskjuggler export John Hendy
2013-04-01  0:16 ` John Hendy
2013-04-01  0:44   ` John Hendy
2013-04-01 14:21 ` Nicolas Goaziou [this message]
2013-04-01 14:53   ` John Hendy
2013-04-01 15:20     ` Nicolas Goaziou
2013-04-01 16:00       ` John Hendy
2013-04-01 16:38         ` Nicolas Goaziou
2013-04-01 16:57           ` John Hendy
2013-04-01 17:05             ` Nicolas Goaziou
2013-04-02  3:27               ` John Hendy
2013-04-01 20:56             ` Item task_id not being used in taskjuggler export & tj prefixing Buddy Butterfly
2013-04-01 20:59               ` Buddy Butterfly
2013-04-01 21:53               ` John Hendy
2013-04-01 22:01                 ` Nicolas Goaziou
2013-04-02  3:24                   ` John Hendy
2013-04-25  7:52                     ` Christian Egli
2013-04-04 13:59                 ` Buddy Butterfly
2013-04-24 20:09                 ` Christian Egli
2013-04-24 19:51               ` Christian Egli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eheutjpz.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jw.hendy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).