* 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 --]
Hi,
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."
(interactive)
(org-store-agenda-views)
(let ((org-export-filter-parse-tree-functions
'(gtd-filter-scheduled-todo-tasks)))
(org-icalendar-combine-agenda-files)))
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...
Cheers,
Chris
[-- 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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.