[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Filter tasks when exporting to iCalendar

From: Chris Poole
Subject: [O] Filter tasks when exporting to iCalendar
Date: Sat, 17 May 2014 12:12:55 +0100


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 '(gtd-filter-scheduled-todo-tasks)))

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]