emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Filter tasks when exporting to iCalendar
@ 2014-05-17 11:12 Chris Poole
  0 siblings, 0 replies; only message in thread
From: Chris Poole @ 2014-05-17 11:12 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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


I'm trying to filter tasks such that only tasks that aren't done, but are
scheduled or have deadlines, are exported to iCalendar.

I have this so far:

(setq org-icalendar-use-scheduled '(todo-start)
        org-icalendar-use-deadline '(todo-due)
        org-icalendar-include-todo t
        org-icalendar-include-body nil
        org-icalendar-alarm-time 15
        org-icalendar-with-timestamps 'active)

(defun gtd-filter-scheduled-todo-tasks (data backend info)
  "Filter iCalendar export to include only TODO tasks that are
not done, but which are scheduled or have a deadline."
  (when (eq backend 'icalendar)
    (org-element-map data 'headline
      (lambda (hl)
        (when (or (not (equal 'todo (org-element-property :todo-type hl)))
                  (equal "DONE" (org-element-property :todo-keyword hl))
                  (not (or (org-element-property :scheduled hl)
                           (org-element-property :deadline hl))))
          (org-export-ignore-element hl info))) info) data))

(defun gtd-export-agendas-and-calendar ()
  "Store agenda views as plain text files, and export scheduled
events to a combined iCalendar file. Filter the calendar using
`gtd-filter-scheduled-todo-tasks', only allowing tasks that
aren't DONE, but are scheduled."
  (let ((org-export-filter-parse-tree-functions

But it leaves an empty calendar.ics file. Anyone know where I'm going wrong?
I assume that org-export-ignore-element is updating `info' in place.

I can't work out why it's not working...


[-- Attachment #2: Type: text/html, Size: 2366 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-17 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-17 11:12 Filter tasks when exporting to iCalendar Chris Poole

Code repositories for project(s) associated with this public inbox


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).