[Top][All Lists]

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

Re: [O] Export to iCalendar only not DONE, scheduled tasks?

From: Arun Persaud
Subject: Re: [O] Export to iCalendar only not DONE, scheduled tasks?
Date: Mon, 05 May 2014 15:08:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0


> I've been searching round the manual, and blogs, to find a way to do this.
> I want to export all of the scheduled/deadline tasks that are not in a
> DONE state to an iCalendar file.
> Can this be done?

pretty sure this can be done. I export only events to an ics file that
have a start and an end date and are not in a certain category. For this
I use

(defun org-mycal-export-limit (content backend info)
  "Limit the export to items that have a date, time and a range. Also
exclude certain categories."
  (when (eq backend 'icalendar)
    (setq org-tst-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ...
    (setq org-tstr-regexp (concat org-tst-regexp "--?-?" org-tst-regexp))
      ; get categories
      (setq mycategory (org-get-category))
      ; get start and end of tree
      (org-back-to-heading t)
      (setq mystart    (point))
      (setq myend      (point))
      (goto-char mystart)
      ; search for timerange
      (setq myresult (re-search-forward org-tstr-regexp myend t))
      ; search for categories to exclude
      (setq mycatp (member mycategory org-export-exclude-category))
      ; return text if ok, nil when not ok
      (if (and myresult (not mycatp)) content nil))))

(defun org-mycal-export ()
  (let ((org-export-filter-final-output-functions

NB org-export-exclude-category is defined somewhere else

You can look up org-export-filter-final-output-functions and other hooks
at http://orgmode.org/worg/doc.html. I overwrite that hook and have it
return the content if I like the item and skip it by returning nil if I
don't like it.

You can probably use org-entry-is-done-p or org-get-todo-state to figure
out if your entry is DONE or not and org-get-scheduled-time/
org-get-deadline-time to figure out if it's scheduled.



reply via email to

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