emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-icalendar: fix handling of timestamps
@ 2013-08-11  2:03 Viktor Rosenfeld
  2013-08-11  2:13 ` Aaron Ecay
  2013-08-11  7:30 ` Nicolas Goaziou
  0 siblings, 2 replies; 10+ messages in thread
From: Viktor Rosenfeld @ 2013-08-11  2:03 UTC (permalink / raw)
  To: emacs-orgmode

  * ox-icalendar.el (org-icalendar-entry): Honor setting of
  `org-icalendar-with-timestamps' for timestamps on headlines
  and checkboxes.

  The setting `org-icalendar-with-timestamps' was only applied
  to timestamps which do not appear on a heading or on a
  checkbox. E.g., with `org-icalendar-with-timestamps' set to
  'active, an heading containing an inactive timestamp on would
  be exported. This patch fixes this.

TINYCHANGE
---
 lisp/ox-icalendar.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index c6ab295..8f15124 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -580,15 +580,24 @@ inlinetask within the section."
      ;; When collecting plain timestamps from a headline and
      ;; its title, skip inlinetasks since collection will
      ;; happen once ENTRY is one of them.
-     (let ((counter 0))
+     (let ((counter 0)
+     (with-timestamps (plist-get info :with-timestamps)))
        (mapconcat
         'identity
         (org-element-map (cons (org-element-property :title entry)
              (org-element-contents inside))
       'timestamp
     (lambda (ts)
-      (let ((uid (format "TS%d-%s" (incf counter) uid)))
-        (org-icalendar--vevent entry ts uid summary loc desc cat)))
+      (let ((type (org-element-property :type ts))
+      (uid (format "TS%d-%s" (incf counter) uid)))
+        (when (or (eq with-timestamps 'all)
+            (and (eq with-timestamps 'active)
+           (or (eq type 'active)
+         (eq type 'active-range)))
+            (and (eq with-timestamps 'inactive)
+           (or (eq type 'inactive)
+         (eq type 'inactive-range))))
+          (org-icalendar--vevent entry ts uid summary loc desc cat))))
     info nil (and (eq type 'headline) 'inlinetask))
         ""))
      ;; Task: First check if it is appropriate to export it.
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-08-15  7:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-11  2:03 [PATCH] ox-icalendar: fix handling of timestamps Viktor Rosenfeld
2013-08-11  2:13 ` Aaron Ecay
2013-08-11 12:53   ` Viktor Rosenfeld
2013-08-15  7:55     ` Nicolas Goaziou
2013-08-11  7:30 ` Nicolas Goaziou
2013-08-11 12:42   ` Viktor Rosenfeld
2013-08-11 13:15     ` Nicolas Goaziou
2013-08-11 14:14       ` Viktor Rosenfeld
2013-08-11 15:09         ` Viktor Rosenfeld
2013-08-15  7:52           ` Nicolas Goaziou

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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