emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kosyrev Serge <_deepfire@feelingofgreen.ru>
To: emacs-orgmode@gnu.org
Subject: [PATCH 2/8] ox-taskjuggler.el: factor 'org-export-map-special-nodes'
Date: Sun, 8 Nov 2015 13:13:54 +0300	[thread overview]
Message-ID: <87twoulrqy.fsf_-_@feelingofgreen.ru> (raw)
In-Reply-To: <87y4e6lrs9.fsf@feelingofgreen.ru> (Kosyrev Serge's message of "Sun, 8 Nov 2015 13:12:20 +0300")


* 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

  reply	other threads:[~2015-11-09 22:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 22:35 [PATCH 0/8] A bunch of fixes for contrib/ox-taskjuggler.el Kosyrev Serge
2015-11-08 10:12 ` [PATCH 1/8] ox-taskjuggler.el: allow direct 'leaves' specification Kosyrev Serge
2015-11-08 10:13   ` Kosyrev Serge [this message]
2015-11-12 16:42     ` [PATCH 2/8] ox-taskjuggler.el: factor 'org-export-map-special-nodes' Rasmus

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=87twoulrqy.fsf_-_@feelingofgreen.ru \
    --to=_deepfire@feelingofgreen.ru \
    --cc=emacs-orgmode@gnu.org \
    /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).