From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kosyrev Serge <_deepfire@feelingofgreen.ru> Subject: [PATCH 2/8] ox-taskjuggler.el: factor 'org-export-map-special-nodes' Date: Sun, 8 Nov 2015 13:13:54 +0300 Message-ID: <87twoulrqy.fsf_-_@feelingofgreen.ru> References: <8737wen6gr.fsf@feelingofgreen.ru> <87y4e6lrs9.fsf@feelingofgreen.ru> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1Zvv8j-0006nU-5w for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:42:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1Zvv8f-0005gn-W4 for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:42:17 -0500 Received: from [80.92.100.69] (port=45592 helo=mail.feelingofgreen.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1Zvv8f-0005gO-P7 for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:42:13 -0500 Received: from andromedae (andromedae.feelingofgreen.ru [10.128.0.213]) by mail.feelingofgreen.ru (Postfix) with ESMTPA id B817032764588 for ; Tue, 10 Nov 2015 02:05:19 +0300 (MSK) In-Reply-To: <87y4e6lrs9.fsf@feelingofgreen.ru> (Kosyrev Serge's message of "Sun, 8 Nov 2015 13:12:20 +0300") 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-map-special-nodes): new function to capture mapping over tagged special nodes. (org-taskjuggler-project-plan): factor to use the new function. --- contrib/lisp/ox-taskjuggler.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el index ce4a8ab..2cf2c78 100644 --- a/contrib/lisp/ox-taskjuggler.el +++ b/contrib/lisp/ox-taskjuggler.el @@ -625,6 +625,12 @@ doesn't include leading \"depends\"." ;;; Translator Functions +(defun org-taskjuggler-map-special-nodes (tag tree f) + (org-element-map tree 'headline + (lambda (hl) + (and (member tag (org-export-get-tags hl info)) + (funcall f hl))) + info nil 'headline)) (defun org-taskjuggler-project-plan (contents info) "Build TaskJuggler project plan. @@ -647,13 +653,10 @@ Return complete project plan as a string in TaskJuggler syntax." ;; `org-taskjuggler-resource-tag'. Only gather top level ;; resources. (apply 'append - (org-element-map tree 'headline - (lambda (hl) - (and (member org-taskjuggler-resource-tag - (org-export-get-tags hl info)) - (org-element-map (org-element-contents hl) 'headline - 'identity info nil 'headline))) - info nil 'headline)))) + (org-taskjuggler-map-special-nodes + org-taskjuggler-resource-tag tree + (lambda (hl) (org-element-map (org-element-contents hl) 'headline + 'identity info nil 'headline)))))) ;; Assign a unique ID to each resource. Store it under ;; `:taskjuggler-unique-ids' property in INFO. (setq info -- 2.5.0