Mercurial > emacs
annotate lisp/calendar/icalendar.el @ 57386:a698ac56864a
(tar-summarize-buffer): Use progress reporter.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 08 Oct 2004 17:31:51 +0000 |
parents | f024640dc5e4 |
children | 376b47c63cfd |
rev | line source |
---|---|
57337
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1 ;;; icalendar.el --- iCalendar implementation |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
2 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
3 ;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
4 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
5 ;; Author: Ulf Jasper <ulf.jasper@web.de> |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
6 ;; Created: August 2002 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
7 ;; Keywords: calendar |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
8 ;; Human-Keywords: calendar, diary, iCalendar, vCalendar |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
9 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
11 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
15 ;; any later version. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
16 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
21 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
25 ;; Boston, MA 02111-1307, USA. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
26 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
27 ;;; Commentary: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
28 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
29 ;; This package is documented in the Emacs Manual. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
30 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
31 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
32 ;;; History: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
33 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
34 ;; 0.06 Bugfixes regarding icalendar-import-format-*. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
35 ;; Fix in icalendar-convert-diary-to-ical -- thanks to Philipp Grau. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
36 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
37 ;; 0.05: New import format scheme: Replaced icalendar-import-prefix-*, |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
38 ;; icalendar-import-ignored-properties, and |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
39 ;; icalendar-import-separator with icalendar-import-format(-*). |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
40 ;; icalendar-import-file and icalendar-convert-diary-to-ical |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
41 ;; have an extra parameter which should prevent them from |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
42 ;; erasing their target files (untested!). |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
43 ;; Tested with Emacs 21.3.2 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
44 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
45 ;; 0.04: Bugfix: import: double quoted param values did not work |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
46 ;; Read DURATION property when importing. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
47 ;; Added parameter icalendar-duration-correction. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
48 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
49 ;; 0.03: Export takes care of european-calendar-style. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
50 ;; Tested with Emacs 21.3.2 and XEmacs 21.4.12 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
51 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
52 ;; 0.02: Should work in XEmacs now. Thanks to Len Trigg for the |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
53 ;; XEmacs patches! |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
54 ;; Added exporting from Emacs diary to ical. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
55 ;; Some bugfixes, after testing with calendars from |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
56 ;; http://icalshare.com. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
57 ;; Tested with Emacs 21.3.2 and XEmacs 21.4.12 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
58 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
59 ;; 0.01: First published version. Trial version. Alpha version. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
60 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
61 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
62 ;; To Do: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
63 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
64 ;; * Import from ical: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
65 ;; + Need more properties for icalendar-import-format |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
66 ;; + check vcalendar version |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
67 ;; + check (unknown) elements |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
68 ;; + recurring events! |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
69 ;; + works for european style calendars only! Does it? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
70 ;; + alarm |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
71 ;; + exceptions in recurring events |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
72 ;; + the parser is too soft |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
73 ;; + error log is incomplete |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
74 ;; + nice to have: #include "webcal://foo.com/some-calendar.ics" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
75 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
76 ;; * Export into ical |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
77 ;; + diary-date, diary-float, and self-made sexp entries are not |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
78 ;; understood |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
79 ;; + timezones, currently all times are local! |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
80 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
81 ;; * Other things |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
82 ;; + defcustom icalendar-import-ignored-properties does not work with |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
83 ;; XEmacs. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
84 ;; + clean up all those date/time parsing functions |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
85 ;; + Handle todo items? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
86 ;; + Check iso 8601 for datetime and period |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
87 ;; + Which chars to (un)escape? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
88 ;; + Time to find out how the profiler works? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
89 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
90 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
91 ;;; Code: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
92 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
93 (defconst icalendar-version 0.06 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
94 "Version number of icalendar.el.") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
95 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
96 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
97 ;; Customizables |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
98 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
99 (defgroup icalendar nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
100 "Icalendar support." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
101 :prefix "icalendar-" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
102 :group 'calendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
103 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
104 (defcustom icalendar-import-format |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
105 "%s%d%l%o" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
106 "Format string for importing events from iCalendar into Emacs diary. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
107 This string defines how iCalendar events are inserted into diary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
108 file. Meaning of the specifiers: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
109 %d Description, see `icalendar-import-format-description' |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
110 %l Location, see `icalendar-import-format-location' |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
111 %o Organizer, see `icalendar-import-format-organizer' |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
112 %s Subject, see `icalendar-import-format-subject'" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
113 :type 'string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
114 :group 'icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
115 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
116 (defcustom icalendar-import-format-subject |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
117 "%s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
118 "Format string defining how the subject element is formatted. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
119 This applies only if the subject is not empty! `%s' is replaced |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
120 by the subject." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
121 :type 'string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
122 :group 'icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
123 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
124 (defcustom icalendar-import-format-description |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
125 "\n Desc: %s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
126 "Format string defining how the description element is formatted. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
127 This applies only if the description is not empty! `%s' is |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
128 replaced by the description." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
129 :type 'string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
130 :group 'icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
131 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
132 (defcustom icalendar-import-format-location |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
133 "\n Location: %s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
134 "Format string defining how the location element is formatted. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
135 This applies only if the location is not empty! `%s' is replaced |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
136 by the location." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
137 :type 'string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
138 :group 'icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
139 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
140 (defcustom icalendar-import-format-organizer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
141 "\n Organizer: %s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
142 "Format string defining how the organizer element is formatted. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
143 This applies only if the organizer is not empty! `%s' is |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
144 replaced by the organizer." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
145 :type 'string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
146 :group 'icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
147 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
148 (defcustom icalendar-duration-correction |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
149 t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
150 "Workaround for all-day events. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
151 If non-nil the length=duration of iCalendar appointments that |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
152 have a length of exactly n days is decreased by one day. This |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
153 fixes problems with all-day events, which appear to be one day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
154 longer than they are." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
155 :type 'boolean |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
156 :group 'icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
157 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
158 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
159 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
160 ;; NO USER SERVICABLE PARTS BELOW THIS LINE |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
161 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
162 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
163 (defconst icalendar-weekdayabbrev-table |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
164 '(("mon\\(day\\)?" . "MO") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
165 ("tue\\(sday\\)?" . "TU") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
166 ("wed\\(nesday\\)?" . "WE") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
167 ("thu\\(rsday\\)?" . "TH") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
168 ("fri\\(day\\)?" . "FR") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
169 ("sat\\(urday\\)?" . "SA") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
170 ("sun\\(day\\)?" . "SU")) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
171 "Translation table for weekdays.") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
172 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
173 (defconst icalendar-monthnumber-table |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
174 '(("^jan\\(uar\\)?y?$" . 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
175 ("^feb\\(ruar\\)?y?$" . 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
176 ("^mar\\(ch\\)?\\|märz?$" . 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
177 ("^apr\\(il\\)?$" . 4) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
178 ("^ma[iy]$" . 5) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
179 ("^jun[ie]?$" . 6) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
180 ("^jul[iy]?$" . 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
181 ("^aug\\(ust\\)?$" . 8) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
182 ("^sep\\(tember\\)?$" . 9) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
183 ("^o[ck]t\\(ober\\)?$" . 10) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
184 ("^nov\\(ember\\)?$" . 11) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
185 ("^de[cz]\\(ember\\)?$" . 12)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
186 "Regular expressions for month names. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
187 Currently this matches only German and English.") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
188 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
189 (defvar icalendar-debug nil ".") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
190 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
191 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
192 ;; all the other libs we need |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
193 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
194 (require 'calendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
195 (require 'appt) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
196 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
197 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
198 ;; Core functionality |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
199 ;; Functions for parsing icalendars, importing and so on |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
200 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
201 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
202 (defun icalendar-get-unfolded-buffer (folded-ical-buffer) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
203 "Return a new buffer containing the unfolded contents of a buffer. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
204 Folding is the iCalendar way of wrapping long lines. In the |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
205 created buffer all occurrences of CR LF BLANK are replaced by the |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
206 empty string. Argument FOLDED-ICAL-BUFFER is the unfolded input |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
207 buffer." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
208 (let ((unfolded-buffer (get-buffer-create " *icalendar-work*"))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
209 (save-current-buffer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
210 (set-buffer unfolded-buffer) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
211 (erase-buffer) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
212 (insert-buffer folded-ical-buffer) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
213 (while (re-search-forward "\r?\n[ \t]" nil t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
214 (replace-match "" nil nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
215 ) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
216 unfolded-buffer)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
217 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
218 ;; Replace regexp RE with RP in string ST and return the new string. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
219 ;; This is here for compatibility with XEmacs. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
220 (defsubst icalendar-rris (re rp st) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
221 ;; XEmacs: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
222 (if (fboundp 'replace-in-string) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
223 (save-match-data ;; apparently XEmacs needs save-match-data |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
224 (replace-in-string st re rp)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
225 ;; Emacs: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
226 (replace-regexp-in-string re rp st))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
227 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
228 (defun icalendar-read-element (invalue inparams) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
229 "Recursively read the next iCalendar element in the current buffer. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
230 INVALUE gives the current iCalendar element we are reading. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
231 INPARAMS gives the current parameters..... |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
232 This function calls itself recursively for each nested calendar element |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
233 it finds" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
234 (let (element children line name params param param-name param-value |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
235 value |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
236 (continue t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
237 (setq children '()) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
238 (while (and continue |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
239 (re-search-forward "^\\([A-Za-z0-9-]+\\)[;:]" nil t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
240 (setq name (intern (match-string 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
241 (backward-char 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
242 (setq params '()) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
243 (setq line '()) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
244 (while (looking-at ";") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
245 (re-search-forward ";\\([A-Za-z0-9-]+\\)=" nil nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
246 (setq param-name (intern (match-string 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
247 (re-search-forward "\\(\\([^;,:\"]+\\)\\|\"\\([^\"]+\\)\"\\)[;:]" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
248 nil t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
249 (backward-char 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
250 (setq param-value (or (match-string 2) (match-string 3))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
251 (setq param (list param-name param-value)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
252 (while (looking-at ",") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
253 (re-search-forward "\\(\\([^;,:]+\\)\\|\"\\([^\"]+\\)\"\\)" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
254 nil t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
255 (if (match-string 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
256 (setq param-value (match-string 2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
257 (setq param-value (match-string 3))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
258 (setq param (append param param-value))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
259 (setq params (append params param))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
260 (unless (looking-at ":") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
261 (error "Oops")) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
262 (forward-char 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
263 (re-search-forward "\\(.*\\)\\(\r?\n[ \t].*\\)*" nil t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
264 (setq value (icalendar-rris "\r?\n[ \t]" "" (match-string 0))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
265 (setq line (list name params value)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
266 (cond ((eq name 'BEGIN) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
267 (setq children |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
268 (append children |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
269 (list (icalendar-read-element (intern value) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
270 params))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
271 ((eq name 'END) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
272 (setq continue nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
273 (t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
274 (setq element (append element (list line)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
275 (if invalue |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
276 (list invalue inparams element children) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
277 children))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
278 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
279 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
280 ;; helper functions for examining events |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
281 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
282 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
283 (defsubst icalendar-get-all-event-properties (event) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
284 "Return the list of properties in this EVENT." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
285 (car (cddr event))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
286 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
287 (defun icalendar-get-event-property (event prop) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
288 "For the given EVENT return the value of the property PROP." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
289 (catch 'found |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
290 (let ((props (car (cddr event))) pp) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
291 (while props |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
292 (setq pp (car props)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
293 (if (eq (car pp) prop) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
294 (throw 'found (car (cddr pp)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
295 (setq props (cdr props)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
296 nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
297 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
298 (defun icalendar-set-event-property (event prop new-value) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
299 "For the given EVENT set the property PROP to the value NEW-VALUE." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
300 (catch 'found |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
301 (let ((props (car (cddr event))) pp) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
302 (while props |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
303 (setq pp (car props)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
304 (when (eq (car pp) prop) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
305 (setcdr (cdr pp) new-value) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
306 (throw 'found (car (cddr pp)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
307 (setq props (cdr props))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
308 (setq props (car (cddr event))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
309 (setcar (cddr event) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
310 (append props (list (list prop nil new-value))))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
311 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
312 (defun icalendar-get-children (node name) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
313 "Return all children of the given NODE which have a name NAME. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
314 For instance the VCALENDAR node can have VEVENT children as well as VTODO |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
315 children." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
316 (let ((result nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
317 (children (cadr (cddr node)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
318 (when (eq (car node) name) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
319 (setq result node)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
320 ;;(message "%s" node) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
321 (when children |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
322 (let ((subresult |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
323 (delq nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
324 (mapcar (lambda (n) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
325 (icalendar-get-children n name)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
326 children)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
327 (if subresult |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
328 (if result |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
329 (setq result (append result subresult)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
330 (setq result subresult))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
331 result)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
332 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
333 ; private |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
334 (defun icalendar-all-events (icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
335 "Return the list of all existing events in the given ICALENDAR." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
336 (interactive "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
337 (icalendar-get-children (car icalendar) 'VEVENT)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
338 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
339 (defun icalendar-split-value (value-string) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
340 "Splits VALUE-STRING at ';='." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
341 (let ((result '()) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
342 param-name param-value) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
343 (when value-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
344 (save-current-buffer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
345 (set-buffer (get-buffer-create " *ical-temp*")) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
346 (set-buffer-modified-p nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
347 (erase-buffer) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
348 (insert value-string) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
349 (goto-char (point-min)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
350 (while |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
351 (re-search-forward |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
352 "\\([A-Za-z0-9-]+\\)=\\(\\([^;,:]+\\)\\|\"\\([^\"]+\\)\"\\);?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
353 nil t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
354 (setq param-name (intern (match-string 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
355 (setq param-value (match-string 2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
356 (setq result |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
357 (append result (list (list param-name param-value))))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
358 result)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
359 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
360 (defun icalendar-decode-isodatetime (isodatetimestring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
361 "Return ISODATETIMESTRING in format like `decode-time'. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
362 Converts from ISO-8601 to Emacs representation. If ISODATETIMESTRING |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
363 specifies UTC time (trailing letter Z) the decoded time is given in |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
364 the local time zone! FIXME: TZID-attributes are ignored....! FIXME: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
365 multiple comma-separated values should be allowed!" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
366 (icalendar-dmsg isodatetimestring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
367 (if isodatetimestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
368 ;; day/month/year must be present |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
369 (let ((year (read (substring isodatetimestring 0 4))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
370 (month (read (substring isodatetimestring 4 6))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
371 (day (read (substring isodatetimestring 6 8))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
372 (hour 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
373 (minute 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
374 (second 0)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
375 (when (> (length isodatetimestring) 12) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
376 ;; hour/minute present |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
377 (setq hour (read (substring isodatetimestring 9 11))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
378 (setq minute (read (substring isodatetimestring 11 13)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
379 (when (> (length isodatetimestring) 14) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
380 ;; seconds present |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
381 (setq second (read (substring isodatetimestring 13 15)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
382 (when (and (> (length isodatetimestring) 15) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
383 ;; UTC specifier present |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
384 (char-equal ?Z (aref isodatetimestring 15))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
385 ;; if not UTC add current-time-zone offset |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
386 (setq second (+ (car (current-time-zone)) second))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
387 ;; create the decoded date-time |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
388 ;; FIXME!?! |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
389 (condition-case nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
390 (decode-time (encode-time second minute hour day month year)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
391 (error |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
392 (message "Cannot decode \"%s\"" isodatetimestring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
393 ;; hope for the best... |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
394 (list second minute hour day month year 0 nil 0)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
395 ;; isodatetimestring == nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
396 nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
397 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
398 (defun icalendar-decode-isoduration (isodurationstring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
399 "Return ISODURATIONSTRING in format like `decode-time'. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
400 Converts from ISO-8601 to Emacs representation. If ISODURATIONSTRING |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
401 specifies UTC time (trailing letter Z) the decoded time is given in |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
402 the local time zone! FIXME: TZID-attributes are ignored....! FIXME: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
403 multiple comma-separated values should be allowed!" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
404 (if isodurationstring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
405 (save-match-data |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
406 (string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
407 (concat |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
408 "^P[+-]?\\(" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
409 "\\(\\([0-9]+\\)D\\)" ; days only |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
410 "\\|" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
411 "\\(\\(\\([0-9]+\\)D\\)?T\\(\\([0-9]+\\)H\\)?" ; opt days |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
412 "\\(\\([0-9]+\\)M\\)?\\(\\([0-9]+\\)S\\)?\\)" ; mand. time |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
413 "\\|" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
414 "\\(\\([0-9]+\\)W\\)" ; weeks only |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
415 "\\)$") isodurationstring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
416 (let ((seconds 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
417 (minutes 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
418 (hours 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
419 (days 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
420 (months 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
421 (years 0)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
422 (cond |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
423 ((match-beginning 2) ;days only |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
424 (setq days (read (substring isodurationstring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
425 (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
426 (match-end 3)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
427 (when icalendar-duration-correction |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
428 (setq days (1- days)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
429 ((match-beginning 4) ;days and time |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
430 (if (match-beginning 5) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
431 (setq days (* 7 (read (substring isodurationstring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
432 (match-beginning 6) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
433 (match-end 6)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
434 (if (match-beginning 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
435 (setq hours (read (substring isodurationstring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
436 (match-beginning 8) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
437 (match-end 8))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
438 (if (match-beginning 9) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
439 (setq minutes (read (substring isodurationstring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
440 (match-beginning 10) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
441 (match-end 10))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
442 (if (match-beginning 11) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
443 (setq seconds (read (substring isodurationstring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
444 (match-beginning 12) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
445 (match-end 12))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
446 ) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
447 ((match-beginning 13) ;weeks only |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
448 (setq days (* 7 (read (substring isodurationstring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
449 (match-beginning 14) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
450 (match-end 14)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
451 ) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
452 (list seconds minutes hours days months years))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
453 ;; isodatetimestring == nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
454 nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
455 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
456 (defun icalendar-add-decoded-times (time1 time2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
457 "Add TIME1 to TIME2. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
458 Both times must be given in decoded form. One of these times must be |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
459 valid (year > 1900 or something)." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
460 ;; FIXME: does this function exist already? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
461 (decode-time (encode-time |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
462 (+ (nth 0 time1) (nth 0 time2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
463 (+ (nth 1 time1) (nth 1 time2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
464 (+ (nth 2 time1) (nth 2 time2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
465 (+ (nth 3 time1) (nth 3 time2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
466 (+ (nth 4 time1) (nth 4 time2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
467 (+ (nth 5 time1) (nth 5 time2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
468 nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
469 nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
470 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
471 ))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
472 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
473 (defun icalendar-datetime-to-noneuropean-date (datetime) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
474 "Convert the decoded DATETIME to non-european-style format. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
475 Non-European format: (month day year)." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
476 (if datetime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
477 (list (nth 4 datetime) ;month |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
478 (nth 3 datetime) ;day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
479 (nth 5 datetime));year |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
480 ;; datetime == nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
481 nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
482 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
483 (defun icalendar-datetime-to-european-date (datetime) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
484 "Convert the decoded DATETIME to European format. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
485 European format: (day month year). |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
486 FIXME" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
487 (if datetime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
488 (format "%d %d %d" (nth 3 datetime); day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
489 (nth 4 datetime) ;month |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
490 (nth 5 datetime));year |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
491 ;; datetime == nil |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
492 nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
493 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
494 (defun icalendar-datetime-to-colontime (datetime) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
495 "Extract the time part of a decoded DATETIME into 24-hour format. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
496 Note that this silently ignores seconds." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
497 (format "%02d:%02d" (nth 2 datetime) (nth 1 datetime))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
498 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
499 (defun icalendar-get-month-number (monthname) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
500 "Return the month number for the given MONTHNAME." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
501 (save-match-data |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
502 (let ((case-fold-search t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
503 (assoc-default monthname icalendar-monthnumber-table |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
504 'string-match)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
505 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
506 (defun icalendar-get-weekday-abbrev (weekday) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
507 "Return the abbreviated WEEKDAY." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
508 ;;FIXME: ISO-like(?). |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
509 (save-match-data |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
510 (let ((case-fold-search t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
511 (assoc-default weekday icalendar-weekdayabbrev-table |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
512 'string-match)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
513 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
514 (defun icalendar-datestring-to-isodate (datestring &optional day-shift) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
515 "Convert diary-style DATESTRING to iso-style date. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
516 If DAY-SHIFT is non-nil, the result is shifted by DAY-SHIFT days |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
517 -- DAY-SHIFT must be either nil or an integer. This function |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
518 takes care of european-style." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
519 (let ((day -1) month year) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
520 (save-match-data |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
521 (cond (;; numeric date |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
522 (string-match (concat "\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
523 "0?\\([1-9][0-9]?\\)[ \t/]\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
524 "0?\\([1-9][0-9]?\\),?[ \t/]\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
525 "\\([0-9]\\{4\\}\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
526 datestring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
527 (setq day (read (substring datestring (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
528 (match-end 1)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
529 (setq month (read (substring datestring (match-beginning 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
530 (match-end 2)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
531 (setq year (read (substring datestring (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
532 (match-end 3)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
533 (unless european-calendar-style |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
534 (let ((x month)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
535 (setq month day) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
536 (setq day x)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
537 (;; date contains month names -- european-style |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
538 (and european-calendar-style |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
539 (string-match (concat "\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
540 "0?\\([123]?[0-9]\\)[ \t/]\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
541 "\\([A-Za-z][^ ]+\\)[ \t/]\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
542 "\\([0-9]\\{4\\}\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
543 datestring)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
544 (setq day (read (substring datestring (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
545 (match-end 1)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
546 (setq month (icalendar-get-month-number |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
547 (substring datestring (match-beginning 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
548 (match-end 2)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
549 (setq year (read (substring datestring (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
550 (match-end 3))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
551 (;; date contains month names -- non-european-style |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
552 (and (not european-calendar-style) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
553 (string-match (concat "\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
554 "\\([A-Za-z][^ ]+\\)[ \t/]\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
555 "0?\\([123]?[0-9]\\),?[ \t/]\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
556 "\\([0-9]\\{4\\}\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
557 datestring)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
558 (setq day (read (substring datestring (match-beginning 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
559 (match-end 2)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
560 (setq month (icalendar-get-month-number |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
561 (substring datestring (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
562 (match-end 1)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
563 (setq year (read (substring datestring (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
564 (match-end 3))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
565 (t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
566 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
567 (if (> day 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
568 (let ((mdy (calendar-gregorian-from-absolute |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
569 (+ (calendar-absolute-from-gregorian (list month day year)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
570 (or day-shift 0))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
571 (format "%04d%02d%02d" (nth 2 mdy) (nth 0 mdy) (nth 1 mdy))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
572 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
573 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
574 (defun icalendar-dmsg (&rest args) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
575 "Print message ARGS if `icalendar-debug' is non-nil." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
576 (if icalendar-debug |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
577 (apply 'message args))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
578 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
579 (defun icalendar-diarytime-to-isotime (timestring ampmstring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
580 "Convert a a time like 9:30pm to an iso-conform string like T213000. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
581 In this example the TIMESTRING would be \"9:30\" and the AMPMSTRING |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
582 would be \"pm\"." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
583 (if timestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
584 (let ((starttimenum (read (icalendar-rris ":" "" timestring)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
585 ;; take care of am/pm style |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
586 (if (and ampmstring (string= "pm" ampmstring)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
587 (setq starttimenum (+ starttimenum 1200))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
588 (format "T%04d00" starttimenum)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
589 nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
590 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
591 (defun icalendar-convert-string-for-export (s) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
592 "Escape comma and other critical characters in string S." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
593 (icalendar-rris "," "\\\\," s)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
594 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
595 (defun icalendar-convert-for-import (string) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
596 "Remove escape chars for comma, semicolon etc. from STRING." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
597 (icalendar-rris |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
598 "\\\\n" "\n " (icalendar-rris |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
599 "\\\\\"" "\"" (icalendar-rris |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
600 "\\\\;" ";" (icalendar-rris |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
601 "\\\\," "," string))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
602 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
603 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
604 ;; export -- convert emacs-diary to icalendar |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
605 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
606 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
607 (defun icalendar-convert-diary-to-ical (diary-filename ical-filename |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
608 &optional do-not-clear-diary-file) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
609 "Export diary file to iCalendar format -- erases ical-filename!!!. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
610 Argument DIARY-FILENAME is the input `diary-file'. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
611 Argument ICAL-FILENAME is the output iCalendar file. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
612 If DO-NOT-CLEAR-DIARY-FILE is not nil the target iCalendar file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
613 is not erased." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
614 (interactive "FExport diary data from file: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
615 Finto iCalendar file: ") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
616 (let ((result "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
617 (start 0) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
618 (entry-main "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
619 (entry-rest "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
620 (header "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
621 (contents) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
622 (oops nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
623 (nonmarker (concat "^" (regexp-quote diary-nonmarking-symbol) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
624 "?"))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
625 (save-current-buffer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
626 (set-buffer (find-file diary-filename)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
627 (goto-char (point-min)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
628 (while (re-search-forward |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
629 "^\\([^ \t\n].*\\)\\(\n[ \t].*\\)*" nil t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
630 (setq entry-main (match-string 1)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
631 (if (match-beginning 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
632 (setq entry-rest (match-string 2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
633 (setq entry-rest "")) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
634 (setq header (format "\nBEGIN:VEVENT\nUID:emacs%d%d%d" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
635 (car (current-time)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
636 (cadr (current-time)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
637 (car (cddr (current-time))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
638 (setq oops nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
639 (cond |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
640 ;; anniversaries |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
641 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
642 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
643 "%%(diary-anniversary \\([^)]+\\))\\s-*\\(.*\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
644 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
645 (icalendar-dmsg "diary-anniversary %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
646 (let* ((datetime (substring entry-main (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
647 (match-end 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
648 (summary (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
649 (substring entry-main (match-beginning 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
650 (match-end 2)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
651 (startisostring (icalendar-datestring-to-isodate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
652 datetime)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
653 (endisostring (icalendar-datestring-to-isodate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
654 datetime 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
655 (setq contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
656 (concat "\nDTSTART;VALUE=DATE:" startisostring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
657 "\nDTEND;VALUE=DATE:" endisostring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
658 "\nSUMMARY:" summary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
659 "\nRRULE:FREQ=YEARLY;INTERVAL=1" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
660 ;; the following is redundant, |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
661 ;; but korganizer seems to expect this... ;( |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
662 ;; and evolution doesn't understand it... :( |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
663 ;; so... who is wrong?! |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
664 ";BYMONTH=" (substring startisostring 4 6) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
665 ";BYMONTHDAY=" (substring startisostring 6 8) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
666 ))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
667 (unless (string= entry-rest "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
668 (setq contents (concat contents "\nDESCRIPTION:" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
669 (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
670 entry-rest))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
671 ;; cyclic events |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
672 ;; %%(diary-cyclic ) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
673 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
674 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
675 "%%(diary-cyclic \\([^ ]+\\) +" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
676 "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
677 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
678 (icalendar-dmsg "diary-cyclic %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
679 (let* ((frequency (substring entry-main (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
680 (match-end 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
681 (datetime (substring entry-main (match-beginning 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
682 (match-end 2))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
683 (summary (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
684 (substring entry-main (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
685 (match-end 3)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
686 (startisostring (icalendar-datestring-to-isodate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
687 datetime)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
688 (endisostring (icalendar-datestring-to-isodate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
689 datetime 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
690 (setq contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
691 (concat "\nDTSTART;VALUE=DATE:" startisostring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
692 "\nDTEND;VALUE=DATE:" endisostring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
693 "\nSUMMARY:" summary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
694 "\nRRULE:FREQ=DAILY;INTERVAL=" frequency |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
695 ;; strange: korganizer does not expect |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
696 ;; BYSOMETHING here... |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
697 ))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
698 (unless (string= entry-rest "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
699 (setq contents (concat contents "\nDESCRIPTION:" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
700 (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
701 entry-rest))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
702 ;; diary-date -- FIXME |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
703 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
704 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
705 "%%(diary-date \\([^)]+\\))\\s-*\\(.*\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
706 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
707 (icalendar-dmsg "diary-date %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
708 (setq oops t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
709 ;; float events -- FIXME |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
710 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
711 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
712 "%%(diary-float \\([^)]+\\))\\s-*\\(.*\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
713 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
714 (icalendar-dmsg "diary-float %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
715 (setq oops t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
716 ;; block events |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
717 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
718 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
719 "%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\) +" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
720 "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
721 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
722 (icalendar-dmsg "diary-block %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
723 (let* ((startstring (substring entry-main (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
724 (match-end 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
725 (endstring (substring entry-main (match-beginning 2) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
726 (match-end 2))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
727 (summary (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
728 (substring entry-main (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
729 (match-end 3)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
730 (startisostring (icalendar-datestring-to-isodate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
731 startstring)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
732 (endisostring (icalendar-datestring-to-isodate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
733 endstring 1))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
734 (setq contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
735 (concat "\nDTSTART;VALUE=DATE:" startisostring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
736 "\nDTEND;VALUE=DATE:" endisostring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
737 "\nSUMMARY:" summary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
738 )) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
739 (unless (string= entry-rest "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
740 (setq contents (concat contents "\nDESCRIPTION:" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
741 (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
742 entry-rest)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
743 ;; other sexp diary entries -- FIXME |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
744 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
745 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
746 "%%(\\([^)]+\\))\\s-*\\(.*\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
747 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
748 (icalendar-dmsg "diary-sexp %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
749 (setq oops t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
750 ;; weekly by day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
751 ;; Monday 8:30 Team meeting |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
752 ((and (string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
753 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
754 "\\([a-z]+\\)\\s-+" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
755 "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
756 "\\(-0?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
757 "\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
758 "\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
759 "\\s-*\\(.*\\)$") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
760 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
761 (icalendar-get-weekday-abbrev |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
762 (substring entry-main (match-beginning 1) (match-end 1)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
763 (icalendar-dmsg "weekly %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
764 (let* ((day (icalendar-get-weekday-abbrev |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
765 (substring entry-main (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
766 (match-end 1)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
767 (starttimestring (icalendar-diarytime-to-isotime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
768 (if (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
769 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
770 (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
771 (match-end 3)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
772 nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
773 (if (match-beginning 4) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
774 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
775 (match-beginning 4) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
776 (match-end 4)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
777 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
778 (endtimestring (icalendar-diarytime-to-isotime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
779 (if (match-beginning 6) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
780 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
781 (match-beginning 6) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
782 (match-end 6)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
783 nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
784 (if (match-beginning 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
785 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
786 (match-beginning 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
787 (match-end 7)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
788 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
789 (summary (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
790 (substring entry-main (match-beginning 8) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
791 (match-end 8))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
792 (when starttimestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
793 (unless endtimestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
794 (let ((time (read (icalendar-rris "^T0?" "" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
795 starttimestring)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
796 (setq endtimestring (format "T%06d" (+ 10000 time)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
797 (setq contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
798 (concat "\nDTSTART" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
799 (if starttimestring "" ";VALUE=DATE") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
800 ":19000101" ;; FIXME? Probability that this |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
801 ;; is the right day is 1/7 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
802 (or starttimestring "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
803 "\nDTEND" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
804 (if endtimestring "" ";VALUE=DATE") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
805 ":19000101" ;; FIXME? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
806 (or endtimestring "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
807 "\nSUMMARY:" summary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
808 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=" day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
809 ))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
810 (unless (string= entry-rest "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
811 (setq contents (concat contents "\nDESCRIPTION:" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
812 (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
813 entry-rest))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
814 ;; yearly by day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
815 ;; 1 May Tag der Arbeit |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
816 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
817 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
818 (if european-calendar-style |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
819 "0?\\([1-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
820 "\\([a-z]+\\)\\s-+0?\\([1-9]+[0-9]?\\)\\s-+") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
821 "\\*?\\s-*" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
822 "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
823 "\\(" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
824 "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
825 "\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
826 "\\s-*\\([^0-9]+.*\\)$"; must not match years |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
827 ) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
828 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
829 (icalendar-dmsg "yearly %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
830 (let* ((daypos (if european-calendar-style 1 2)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
831 (monpos (if european-calendar-style 2 1)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
832 (day (read (substring entry-main (match-beginning daypos) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
833 (match-end daypos)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
834 (month (icalendar-get-month-number |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
835 (substring entry-main (match-beginning monpos) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
836 (match-end monpos)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
837 (starttimestring (icalendar-diarytime-to-isotime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
838 (if (match-beginning 4) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
839 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
840 (match-beginning 4) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
841 (match-end 4)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
842 nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
843 (if (match-beginning 5) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
844 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
845 (match-beginning 5) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
846 (match-end 5)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
847 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
848 (endtimestring (icalendar-diarytime-to-isotime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
849 (if (match-beginning 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
850 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
851 (match-beginning 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
852 (match-end 7)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
853 nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
854 (if (match-beginning 8) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
855 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
856 (match-beginning 8) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
857 (match-end 8)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
858 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
859 (summary (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
860 (substring entry-main (match-beginning 9) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
861 (match-end 9))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
862 (when starttimestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
863 (unless endtimestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
864 (let ((time (read (icalendar-rris "^T0?" "" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
865 starttimestring)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
866 (setq endtimestring (format "T%06d" (+ 10000 time)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
867 (setq contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
868 (concat "\nDTSTART" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
869 (if starttimestring "" ";VALUE=DATE") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
870 (format ":1900%02d%02d" month day) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
871 (or starttimestring "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
872 "\nDTEND" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
873 (if endtimestring "" ";VALUE=DATE") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
874 (format ":1900%02d%02d" month day) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
875 (or endtimestring "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
876 "\nSUMMARY:" summary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
877 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
878 (format "%2d" month) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
879 ";BYMONTHDAY=" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
880 (format "%2d" day) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
881 ))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
882 (unless (string= entry-rest "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
883 (setq contents (concat contents "\nDESCRIPTION:" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
884 (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
885 entry-rest))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
886 ;; "ordinary" events, start and end time given |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
887 ;; 1 Feb 2003 Hs Hochzeitsfeier, Dreieich |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
888 ((string-match |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
889 (concat nonmarker |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
890 "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)\\s-+" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
891 "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
892 "\\(" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
893 "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
894 "\\)?" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
895 "\\s-*\\(.*\\)") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
896 entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
897 (icalendar-dmsg "ordinary %s" entry-main) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
898 (let* ((datestring (icalendar-datestring-to-isodate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
899 (substring entry-main (match-beginning 1) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
900 (match-end 1)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
901 (starttimestring (icalendar-diarytime-to-isotime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
902 (if (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
903 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
904 (match-beginning 3) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
905 (match-end 3)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
906 nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
907 (if (match-beginning 4) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
908 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
909 (match-beginning 4) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
910 (match-end 4)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
911 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
912 (endtimestring (icalendar-diarytime-to-isotime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
913 (if (match-beginning 6) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
914 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
915 (match-beginning 6) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
916 (match-end 6)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
917 nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
918 (if (match-beginning 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
919 (substring entry-main |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
920 (match-beginning 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
921 (match-end 7)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
922 nil))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
923 (summary (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
924 (substring entry-main (match-beginning 8) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
925 (match-end 8))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
926 (when starttimestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
927 (unless endtimestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
928 (let ((time (read (icalendar-rris "^T0?" "" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
929 starttimestring)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
930 (setq endtimestring (format "T%06d" (+ 10000 time)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
931 (setq contents (format |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
932 "\nDTSTART%s:%s%s\nDTEND%s:%s%s\nSUMMARY:%s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
933 (if starttimestring "" ";VALUE=DATE") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
934 datestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
935 (or starttimestring "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
936 (if endtimestring "" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
937 ";VALUE=DATE") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
938 datestring |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
939 (or endtimestring "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
940 summary)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
941 (unless (string= entry-rest "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
942 (setq contents (concat contents "\nDESCRIPTION:" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
943 (icalendar-convert-string-for-export |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
944 entry-rest)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
945 ;; everything else |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
946 (t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
947 ;; Oops! what's that? |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
948 (setq oops t))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
949 (if oops |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
950 (message "Cannot export entry on line %d" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
951 (count-lines (point-min) (point))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
952 (setq result (concat result header contents "\nEND:VEVENT")))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
953 ;; we're done, insert everything into the file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
954 (let ((coding-system-for-write 'utf8)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
955 (set-buffer (find-file ical-filename)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
956 (unless do-not-clear-diary-file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
957 (erase-buffer)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
958 (insert |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
959 "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
960 (insert "\nVERSION:2.0") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
961 (insert result) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
962 (insert "\nEND:VCALENDAR\n"))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
963 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
964 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
965 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
966 ;; import -- convert icalendar to emacs-diary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
967 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
968 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
969 ;; user function |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
970 (defun icalendar-import-file (ical-filename diary-filename |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
971 &optional non-marking |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
972 do-not-clear-diary-file) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
973 "Import a iCalendar file and save to a diary file -- erases diary-file! |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
974 Argument ICAL-FILENAME output iCalendar file. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
975 Argument DIARY-FILENAME input `diary-file'. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
976 Optional argument NON-MARKING determines whether events are created as |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
977 non-marking or not. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
978 If DO-NOT-CLEAR-DIARY-FILE is not nil the target diary file is |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
979 not erased." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
980 (interactive "fImport iCalendar data from file: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
981 Finto diary file (will be erased!): |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
982 p") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
983 ;; clean up the diary file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
984 (save-current-buffer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
985 (unless do-not-clear-diary-file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
986 ;; clear the target diary file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
987 (set-buffer (find-file diary-filename)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
988 (erase-buffer)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
989 ;; now load and convert from the ical file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
990 (set-buffer (find-file ical-filename)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
991 (icalendar-extract-ical-from-buffer diary-filename t non-marking))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
992 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
993 ; user function |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
994 (defun icalendar-extract-ical-from-buffer (&optional |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
995 diary-file do-not-ask |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
996 non-marking) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
997 "Extract iCalendar events from current buffer. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
998 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
999 This function searches the current buffer for the first iCalendar |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1000 object, reads it and adds all VEVENT elements to the diary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1001 DIARY-FILE. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1002 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1003 It will ask for each appointment whether to add it to the diary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1004 when DO-NOT-ASK is non-nil. When called interactively, |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1005 DO-NOT-ASK is set to t, so that you are asked fore each event. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1006 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1007 NON-MARKING determines whether diary events are created as |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1008 non-marking. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1009 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1010 This function attempts to notify about problems that occur when |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1011 reading, parsing, or converting iCalendar data!" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1012 (interactive) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1013 (save-current-buffer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1014 ;; prepare ical |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1015 (message "Preparing icalendar...") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1016 (set-buffer (icalendar-get-unfolded-buffer (current-buffer))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1017 (goto-char (point-min)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1018 (message "Preparing icalendar...done") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1019 (if (re-search-forward "^BEGIN:VCALENDAR\\s-*$" nil t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1020 (let (ical-contents ical-errors) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1021 ;; read ical |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1022 (message "Reading icalendar...") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1023 (beginning-of-line) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1024 (setq ical-contents (icalendar-read-element nil nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1025 (message "Reading icalendar...done") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1026 ;; convert ical |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1027 (message "Converting icalendar...") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1028 (setq ical-errors (icalendar-convert-ical-to-diary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1029 ical-contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1030 diary-file do-not-ask non-marking)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1031 (when diary-file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1032 ;; save the diary file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1033 (save-current-buffer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1034 (set-buffer (find-buffer-visiting diary-file)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1035 (save-buffer))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1036 (message "Converting icalendar...done") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1037 (if (and ical-errors (y-or-n-p |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1038 (concat "Something went wrong -- " |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1039 "do you want to see the " |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1040 "error log? "))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1041 (switch-to-buffer " *icalendar-errors*"))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1042 (message |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1043 "Current buffer does not contain icalendar contents!")))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1044 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1045 ;; ---------------------------------------------------------------------- |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1046 ;; private area |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1047 ;; ---------------------------------------------------------------------- |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1048 (defun icalendar-format-ical-event (event) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1049 "Create a string representation of an iCalendar EVENT." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1050 (let ((string icalendar-import-format) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1051 (conversion-list |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1052 '(("%d" DESCRIPTION icalendar-import-format-description) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1053 ("%s" SUMMARY icalendar-import-format-subject) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1054 ("%l" LOCATION icalendar-import-format-location) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1055 ("%o" ORGANIZER icalendar-import-format-organizer)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1056 ;; convert the specifiers in the format string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1057 (mapcar (lambda (i) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1058 (let* ((spec (car i)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1059 (prop (cadr i)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1060 (format (car (cddr i))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1061 (contents (icalendar-get-event-property event prop)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1062 (formatted-contents "")) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1063 ;;(message "%s" event) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1064 ;;(message "contents%s = %s" prop contents) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1065 (when (and contents (> (length contents) 0)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1066 (setq formatted-contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1067 (icalendar-rris "%s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1068 (icalendar-convert-for-import |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1069 contents) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1070 (symbol-value format)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1071 (setq string (icalendar-rris spec |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1072 formatted-contents |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1073 string)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1074 conversion-list) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1075 string)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1076 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1077 (defun icalendar-convert-ical-to-diary (ical-list diary-file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1078 &optional do-not-ask |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1079 non-marking) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1080 "Convert an iCalendar file to an Emacs diary file. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1081 Import VEVENTS from the iCalendar object ICAL-LIST and saves them to a |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1082 DIARY-FILE. If DO-NOT-ASK is nil the user is asked for each event |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1083 whether to actually import it. NON-MARKING determines whether diary |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1084 events are created as non-marking. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1085 This function attempts to return t if something goes wrong. In this |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1086 case an error string which describes all the errors and problems is |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1087 written into the buffer ` *icalendar-errors*'." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1088 (let* ((ev (icalendar-all-events ical-list)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1089 (error-string "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1090 (event-ok t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1091 (found-error nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1092 e diary-string) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1093 ;; step through all events/appointments |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1094 (while ev |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1095 (setq e (car ev)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1096 (setq ev (cdr ev)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1097 (setq event-ok nil) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1098 (condition-case error-val |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1099 (let* ((dtstart (icalendar-decode-isodatetime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1100 (icalendar-get-event-property e 'DTSTART))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1101 (start-d (calendar-date-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1102 (icalendar-datetime-to-noneuropean-date |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1103 dtstart) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1104 t t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1105 (start-t (icalendar-datetime-to-colontime dtstart)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1106 (dtend (icalendar-decode-isodatetime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1107 (icalendar-get-event-property e 'DTEND))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1108 end-d |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1109 end-t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1110 (subject (icalendar-convert-for-import |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1111 (or (icalendar-get-event-property e 'SUMMARY) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1112 "No Subject"))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1113 (rrule (icalendar-get-event-property e 'RRULE)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1114 (rdate (icalendar-get-event-property e 'RDATE)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1115 (duration (icalendar-get-event-property e 'DURATION))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1116 (icalendar-dmsg "%s: %s" start-d subject) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1117 (when duration |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1118 (let ((dtend2 (icalendar-add-decoded-times |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1119 dtstart |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1120 (icalendar-decode-isoduration duration)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1121 (if (and dtend (not (eq dtend dtend2))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1122 (message "Inconsistent endtime and duration for %s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1123 subject)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1124 (setq dtend dtend2))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1125 (setq end-d (if dtend |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1126 (calendar-date-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1127 (icalendar-datetime-to-noneuropean-date |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1128 dtend) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1129 t t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1130 start-d)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1131 (setq end-t (if dtend |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1132 (icalendar-datetime-to-colontime dtend) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1133 start-t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1134 (icalendar-dmsg "start-d: %s, end-d: %s" start-d end-d) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1135 (cond |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1136 ;; recurring event |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1137 (rrule |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1138 (icalendar-dmsg "recurring event") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1139 (let* ((rrule-props (icalendar-split-value rrule)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1140 (frequency (car (cdr (assoc 'FREQ rrule-props)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1141 (until (car (cdr (assoc 'UNTIL rrule-props)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1142 (interval (read (car (cdr (assoc 'INTERVAL |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1143 rrule-props)))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1144 (cond ((string-equal frequency "WEEKLY") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1145 (if (not start-t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1146 (progn |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1147 ;; weekly and all-day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1148 (icalendar-dmsg "weekly all-day") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1149 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1150 (format |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1151 "%%%%(diary-cyclic %d %s)" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1152 (* interval 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1153 (icalendar-datetime-to-european-date |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1154 dtstart)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1155 ;; weekly and not all-day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1156 (let* ((byday (cadr (assoc 'BYDAY rrule-props))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1157 (weekday |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1158 (cdr (rassoc |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1159 byday |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1160 icalendar-weekdayabbrev-table)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1161 (icalendar-dmsg "weekly not-all-day") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1162 (if weekday |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1163 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1164 (format "%s %s%s%s" weekday |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1165 start-t (if end-t "-" "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1166 (or end-t ""))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1167 ;; FIXME!!!! |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1168 ;; DTSTART;VALUE=DATE-TIME:20030919T090000 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1169 ;; DTEND;VALUE=DATE-TIME:20030919T113000 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1170 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1171 (format |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1172 "%%%%(diary-cyclic %s %s) %s%s%s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1173 (* interval 7) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1174 (icalendar-datetime-to-european-date |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1175 dtstart) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1176 start-t (if end-t "-" "") (or end-t "")))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1177 (setq event-ok t)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1178 ;; yearly |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1179 ((string-equal frequency "YEARLY") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1180 (icalendar-dmsg "yearly") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1181 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1182 (format |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1183 "%%%%(diary-anniversary %s)" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1184 (icalendar-datetime-to-european-date dtstart))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1185 (setq event-ok t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1186 ;; FIXME: war auskommentiert: |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1187 ((and (string-equal frequency "DAILY") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1188 ;;(not (string= start-d end-d)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1189 ;;(not start-t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1190 ;;(not end-t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1191 ) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1192 (let ((ds (icalendar-datetime-to-noneuropean-date |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1193 (icalendar-decode-isodatetime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1194 (icalendar-get-event-property e |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1195 'DTSTART)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1196 (de (icalendar-datetime-to-noneuropean-date |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1197 (icalendar-decode-isodatetime |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1198 until)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1199 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1200 (format |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1201 "%%%%(diary-block %d %d %d %d %d %d)" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1202 (nth 1 ds) (nth 0 ds) (nth 2 ds) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1203 (nth 1 de) (nth 0 de) (nth 2 de)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1204 (setq event-ok t))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1205 )) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1206 (rdate |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1207 (icalendar-dmsg "rdate event") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1208 (setq diary-string "") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1209 (mapcar (lambda (datestring) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1210 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1211 (concat diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1212 (format "......")))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1213 (icalendar-split-value rdate))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1214 ;; non-recurring event |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1215 ;; long event |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1216 ((not (string= start-d end-d)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1217 (icalendar-dmsg "non-recurring event") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1218 (let ((ds (icalendar-datetime-to-noneuropean-date dtstart)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1219 (de (icalendar-datetime-to-noneuropean-date dtend))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1220 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1221 (format "%%%%(diary-block %d %d %d %d %d %d)" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1222 (nth 1 ds) (nth 0 ds) (nth 2 ds) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1223 (nth 1 de) (nth 0 de) (nth 2 de)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1224 (setq event-ok t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1225 ;; not all-day |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1226 ((and start-t (or (not end-t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1227 (not (string= start-t end-t)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1228 (icalendar-dmsg "not all day event") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1229 (cond (end-t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1230 (setq diary-string (format "%s %s-%s" start-d |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1231 start-t end-t))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1232 (t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1233 (setq diary-string (format "%s %s" start-d |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1234 start-t)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1235 (setq event-ok t)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1236 ;; all-day event |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1237 (t |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1238 (icalendar-dmsg "all day event") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1239 (setq diary-string start-d) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1240 (setq event-ok t))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1241 ;; add all other elements unless the user doesn't want to have |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1242 ;; them |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1243 (if event-ok |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1244 (progn |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1245 (setq diary-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1246 (concat diary-string " " |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1247 (icalendar-format-ical-event e))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1248 (if do-not-ask (setq subject nil)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1249 (icalendar-add-diary-entry diary-string diary-file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1250 non-marking subject)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1251 ;; event was not ok |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1252 (setq found-error t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1253 (setq error-string |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1254 (format "%s\nCannot handle this event:%s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1255 error-string e)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1256 ;; handle errors |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1257 (error |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1258 (message "Ignoring event \"%s\"" e) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1259 (setq found-error t) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1260 (setq error-string (format "%s\nCannot handle this event: %s" |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1261 error-string e))))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1262 (if found-error |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1263 (save-current-buffer |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1264 (set-buffer (get-buffer-create " *icalendar-errors*")) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1265 (erase-buffer) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1266 (insert error-string))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1267 (message "Converting icalendar...done") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1268 found-error)) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1269 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1270 (defun icalendar-add-diary-entry (string diary-file non-marking |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1271 &optional subject) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1272 "Add STRING to the diary file DIARY-FILE. |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1273 STRING must be a properly formatted valid diary entry. NON-MARKING |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1274 determines whether diary events are created as non-marking. If |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1275 SUBJECT is not nil it must be a string that gives the subject of the |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1276 entry. In this case the user will be asked whether he wants to insert |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1277 the entry." |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1278 (when (or (not subject) ; |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1279 (y-or-n-p (format "Add appointment for `%s' to diary? " |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1280 subject))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1281 (when subject |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1282 (setq non-marking |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1283 (y-or-n-p (format "Make appointment non-marking? ")))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1284 (save-window-excursion |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1285 (unless diary-file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1286 (setq diary-file |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1287 (read-file-name "Add appointment to this diary file: "))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1288 (make-diary-entry string non-marking diary-file)))) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1289 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1290 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1291 ;; (add-hook 'list-diary-entries-hook 'include-icalendar-files) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1292 ;; ====================================================================== |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1293 (defun include-icalendar-files () |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1294 "Not yet implemented.") |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1295 |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1296 (provide 'icalendar) |
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1297 |
57345
f024640dc5e4
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
57337
diff
changeset
|
1298 ;; arch-tag: 74fdbe8e-0451-4e38-bb61-4416e822f4fc |
57337
a1b1850b5a47
New file, from Ulf Jasper <ulf.jasper@web.de>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1299 ;;; icalendar.el ends here |