summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-06-04 13:13:29 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-06-04 13:13:54 +0200
commitadd40f96f1db917c3e028210d1ae09c3af60d071 (patch)
treebe719fd74876f80edc0ca83e20419f4e2dab299d
parent1eb974ed625a07247222795b05a5630b1d42f02b (diff)
downloadorg-mode-add40f96f1db917c3e028210d1ae09c3af60d071.tar.gz
Stop iCalendar export from failing with sexp dates
* lisp/org-icalendar.el (org-ical-ts-to-string): Catch error when parsing tie string.
-rw-r--r--lisp/org-icalendar.el34
1 files changed, 19 insertions, 15 deletions
diff --git a/lisp/org-icalendar.el b/lisp/org-icalendar.el
index 66da256..a50fdb6 100644
--- a/lisp/org-icalendar.el
+++ b/lisp/org-icalendar.el
@@ -27,6 +27,8 @@
;;; Commentary:
(require 'org-exp)
+(eval-when-compile
+ (require 'cl))
(declare-function org-bbdb-anniv-export-ical "org-bbdb" nil)
@@ -589,22 +591,24 @@ CALSCALE:GREGORIAN\n" name user timezone description))))
KEYWORD is added in front, to make a complete line like DTSTART....
When INC is non-nil, increase the hour by two (if time string contains
a time), or the day by one (if it does not contain a time)."
- (let ((t1 (org-parse-time-string s 'nodefault))
+ (let ((t1 (ignore-errors (org-parse-time-string s 'nodefault)))
t2 fmt have-time time)
- (if (and (car t1) (nth 1 t1) (nth 2 t1))
- (setq t2 t1 have-time t)
- (setq t2 (org-parse-time-string s)))
- (let ((s (car t2)) (mi (nth 1 t2)) (h (nth 2 t2))
- (d (nth 3 t2)) (m (nth 4 t2)) (y (nth 5 t2)))
- (when inc
- (if have-time
- (if org-agenda-default-appointment-duration
- (setq mi (+ org-agenda-default-appointment-duration mi))
- (setq h (+ 2 h)))
- (setq d (1+ d))))
- (setq time (encode-time s mi h d m y)))
- (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
- (concat keyword (format-time-string fmt time))))
+ (if (not t1)
+ ""
+ (if (and (car t1) (nth 1 t1) (nth 2 t1))
+ (setq t2 t1 have-time t)
+ (setq t2 (org-parse-time-string s)))
+ (let ((s (car t2)) (mi (nth 1 t2)) (h (nth 2 t2))
+ (d (nth 3 t2)) (m (nth 4 t2)) (y (nth 5 t2)))
+ (when inc
+ (if have-time
+ (if org-agenda-default-appointment-duration
+ (setq mi (+ org-agenda-default-appointment-duration mi))
+ (setq h (+ 2 h)))
+ (setq d (1+ d))))
+ (setq time (encode-time s mi h d m y)))
+ (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
+ (concat keyword (format-time-string fmt time)))))
(provide 'org-icalendar)