From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kosyrev Serge <_deepfire@feelingofgreen.ru> Subject: [PATCH 8/8] ox-taskjuggler.el: allow trimming the task ID from its title Date: Sun, 8 Nov 2015 13:23:00 +0300 Message-ID: <87ziymkd0j.fsf@feelingofgreen.ru> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1ZvvCC-0004sG-Ku for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:45:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1ZvvC9-0007rk-Cl for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:45:52 -0500 Received: from [80.92.100.69] (port=45599 helo=mail.feelingofgreen.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1ZvvC9-0007rO-6B for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:45:49 -0500 Received: from andromedae (andromedae.feelingofgreen.ru [10.128.0.213]) by mail.feelingofgreen.ru (Postfix) with ESMTPA id 3C07032764588 for ; Tue, 10 Nov 2015 02:08:55 +0300 (MSK) 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 * ox-taskjuggler.el (org-taskjuggler-trim-ids-from-titles): new custom (org-taskjuggler--build-task): trim task ids from titles, when the new custom variable asks for this (enabled by default). --- contrib/lisp/ox-taskjuggler.el | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el index d49db62..bca3dc1 100644 --- a/contrib/lisp/ox-taskjuggler.el +++ b/contrib/lisp/ox-taskjuggler.el @@ -374,6 +374,11 @@ task buckets, while still sharing the same resources pool." :group 'org-export-taskjuggler :type 'boolean) +(defcustom org-taskjuggler-trim-ids-from-titles t + "Non-NIL trims the part detected as prefix from resulting task titles." + :group 'org-export-taskjuggler + :type 'boolean) + ;;; Hooks @@ -887,9 +892,16 @@ a unique id will be associated to it." (- org-lowest-priority org-highest-priority))))))))) (concat ;; Opening task. - (format "task %s \"%s\" {\n" - (org-taskjuggler-get-id task info) - (org-taskjuggler-get-name task)) + (let* ((id (org-taskjuggler-get-id task info)) + (raw-name (org-taskjuggler-get-name task)) + (id-len (length id)) + (raw-name-len (length raw-name)) + (name (if org-taskjuggler-trim-ids-from-titles + (if (= raw-name-len id-len) + raw-name + (subseq raw-name (1+ id-len))) + raw-name))) + (format "task %s \"%s\" {\n" id name)) ;; Add default attributes. (and depends (format " depends %s\n" -- 2.5.0