From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Persaud Subject: Re: Export to iCalendar only not DONE, scheduled tasks? Date: Mon, 05 May 2014 15:08:43 -0700 Message-ID: <53680BEB.2070804@lbl.gov> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhR4C-0001CK-Ub for emacs-orgmode@gnu.org; Mon, 05 May 2014 18:09:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhR46-0000ua-0X for emacs-orgmode@gnu.org; Mon, 05 May 2014 18:08:56 -0400 Received: from fe2.lbl.gov ([128.3.41.134]:24567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhR45-0000uL-RT for emacs-orgmode@gnu.org; Mon, 05 May 2014 18:08:49 -0400 Received: by mail-pd0-f176.google.com with SMTP id y13so6333976pdi.21 for ; Mon, 05 May 2014 15:08:46 -0700 (PDT) Received: from [128.3.5.177] (apersaud.dhcp.lbl.gov. [128.3.5.177]) by mx.google.com with ESMTPSA id xz7sm80715243pac.3.2014.05.05.15.08.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 15:08:45 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi > 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\\} ... [0-9]\\{2\\}:[0-9]\\{2\\}[^\r\n>]*?\\)>") (setq org-tstr-regexp (concat org-tst-regexp "--?-?" org-tst-regexp)) (save-excursion ; get categories (setq mycategory (org-get-category)) ; get start and end of tree (org-back-to-heading t) (setq mystart (point)) (org-end-of-subtree) (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 '(org-mycal-export-limit))) (org-icalendar-combine-agenda-files))) 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. HTH Arun