aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Jasper2012-05-29 21:42:49 +0200
committerUlf Jasper2012-05-29 21:42:49 +0200
commit6dbaa1c769c3a0464ec72e4224cbd76c0356a2bf (patch)
tree4246e6205aa14095463e01d7e93724f4f973dd63
parent471fe23dc58361ecad3679a3a57a9f7d949e34d2 (diff)
downloademacs-6dbaa1c769c3a0464ec72e4224cbd76c0356a2bf.tar.gz
emacs-6dbaa1c769c3a0464ec72e4224cbd76c0356a2bf.zip
icalendar-tests: Fix Bug#11525 -- Add icalendar-import-format-uid
2012-05-29 Ulf Jasper <ulf.jasper@web.de> * calendar/icalendar.el (icalendar-export-region): Export UID properly. 2012-05-29 Leo Liu <sdl.web@gmail.com> * calendar/icalendar.el (icalendar-import-format): Add `icalendar-import-format-uid' (Bug#11525). (icalendar-import-format-uid): New. (icalendar--parse-summary-and-rest, icalendar--format-ical-event): Export UID.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/calendar/icalendar.el50
-rw-r--r--test/ChangeLog12
-rw-r--r--test/automated/icalendar-tests.el98
4 files changed, 127 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 83d3f3e4677..b31cc2cef5f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12012-05-29 Ulf Jasper <ulf.jasper@web.de>
2
3 * calendar/icalendar.el
4 (icalendar-export-region): Export UID properly.
5
62012-05-29 Leo <sdl.web@gmail.com>
7 * calendar/icalendar.el (icalendar-import-format): Add
8 `icalendar-import-format-uid' (Bug#11525).
9 (icalendar-import-format-uid): New.
10 (icalendar--parse-summary-and-rest, icalendar--format-ical-event):
11 Export UID.
12
12012-05-29 Stefan Monnier <monnier@iro.umontreal.ca> 132012-05-29 Stefan Monnier <monnier@iro.umontreal.ca>
2 14
3 * emacs-lisp/pcase.el (pcase--expand): Accept different sets of vars in 15 * emacs-lisp/pcase.el (pcase--expand): Accept different sets of vars in
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index f1549ec20b1..5dc687d001b 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -130,6 +130,7 @@ In case of a formatting STRING the following specifiers can be used:
130%s Summary, see `icalendar-import-format-summary' 130%s Summary, see `icalendar-import-format-summary'
131%t Status, see `icalendar-import-format-status' 131%t Status, see `icalendar-import-format-status'
132%u URL, see `icalendar-import-format-url' 132%u URL, see `icalendar-import-format-url'
133%U UID, see `icalendar-import-format-uid'
133 134
134A formatting FUNCTION will be called with a VEVENT as its only 135A formatting FUNCTION will be called with a VEVENT as its only
135argument. It must return a string. See 136argument. It must return a string. See
@@ -179,6 +180,14 @@ the URL."
179 :type 'string 180 :type 'string
180 :group 'icalendar) 181 :group 'icalendar)
181 182
183(defcustom icalendar-import-format-uid
184 "\n UID: %s"
185 "Format string defining how the UID element is formatted.
186This applies only if the UID is not empty! `%s' is replaced by
187the UID."
188 :type 'string
189 :group 'icalendar)
190
182(defcustom icalendar-import-format-status 191(defcustom icalendar-import-format-status
183 "\n Status: %s" 192 "\n Status: %s"
184 "Format string defining how the status element is formatted. 193 "Format string defining how the status element is formatted.
@@ -1017,7 +1026,8 @@ FExport diary data into iCalendar file: ")
1017 (org (cdr (assoc 'org other-elements))) 1026 (org (cdr (assoc 'org other-elements)))
1018 (sta (cdr (assoc 'sta other-elements))) 1027 (sta (cdr (assoc 'sta other-elements)))
1019 (sum (cdr (assoc 'sum other-elements))) 1028 (sum (cdr (assoc 'sum other-elements)))
1020 (url (cdr (assoc 'url other-elements)))) 1029 (url (cdr (assoc 'url other-elements)))
1030 (uid (cdr (assoc 'uid other-elements))))
1021 (if cla 1031 (if cla
1022 (setq contents (concat contents "\nCLASS:" cla))) 1032 (setq contents (concat contents "\nCLASS:" cla)))
1023 (if des 1033 (if des
@@ -1031,10 +1041,12 @@ FExport diary data into iCalendar file: ")
1031 ;;(if sum 1041 ;;(if sum
1032 ;; (setq contents (concat contents "\nSUMMARY:" sum))) 1042 ;; (setq contents (concat contents "\nSUMMARY:" sum)))
1033 (if url 1043 (if url
1034 (setq contents (concat contents "\nURL:" url)))) 1044 (setq contents (concat contents "\nURL:" url)))
1035 1045
1036 (setq header (concat "\nBEGIN:VEVENT\nUID:" 1046 (setq header (concat "\nBEGIN:VEVENT\nUID:"
1037 (icalendar--create-uid entry-full contents))) 1047 (or uid
1048 (icalendar--create-uid entry-full
1049 contents)))))
1038 (setq result (concat result header contents "\nEND:VEVENT"))) 1050 (setq result (concat result header contents "\nEND:VEVENT")))
1039 ;; handle errors 1051 ;; handle errors
1040 (error 1052 (error
@@ -1098,7 +1110,8 @@ Returns an alist."
1098 ;; can't do anything 1110 ;; can't do anything
1099 nil 1111 nil
1100 ;; split summary-and-rest 1112 ;; split summary-and-rest
1101 (let* ((s icalendar-import-format) 1113 (let* ((case-fold-search nil)
1114 (s icalendar-import-format)
1102 (p-cla (or (string-match "%c" icalendar-import-format) -1)) 1115 (p-cla (or (string-match "%c" icalendar-import-format) -1))
1103 (p-des (or (string-match "%d" icalendar-import-format) -1)) 1116 (p-des (or (string-match "%d" icalendar-import-format) -1))
1104 (p-loc (or (string-match "%l" icalendar-import-format) -1)) 1117 (p-loc (or (string-match "%l" icalendar-import-format) -1))
@@ -1106,9 +1119,10 @@ Returns an alist."
1106 (p-sum (or (string-match "%s" icalendar-import-format) -1)) 1119 (p-sum (or (string-match "%s" icalendar-import-format) -1))
1107 (p-sta (or (string-match "%t" icalendar-import-format) -1)) 1120 (p-sta (or (string-match "%t" icalendar-import-format) -1))
1108 (p-url (or (string-match "%u" icalendar-import-format) -1)) 1121 (p-url (or (string-match "%u" icalendar-import-format) -1))
1109 (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url) '<)) 1122 (p-uid (or (string-match "%U" icalendar-import-format) -1))
1123 (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url p-uid) '<))
1110 (ct 0) 1124 (ct 0)
1111 pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url) 1125 pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url pos-uid)
1112 (dotimes (i (length p-list)) 1126 (dotimes (i (length p-list))
1113 ;; Use 'ct' to keep track of current position in list 1127 ;; Use 'ct' to keep track of current position in list
1114 (cond ((and (>= p-cla 0) (= (nth i p-list) p-cla)) 1128 (cond ((and (>= p-cla 0) (= (nth i p-list) p-cla))
@@ -1131,7 +1145,10 @@ Returns an alist."
1131 (setq pos-sum (* 2 ct))) 1145 (setq pos-sum (* 2 ct)))
1132 ((and (>= p-url 0) (= (nth i p-list) p-url)) 1146 ((and (>= p-url 0) (= (nth i p-list) p-url))
1133 (setq ct (+ ct 1)) 1147 (setq ct (+ ct 1))
1134 (setq pos-url (* 2 ct)))) ) 1148 (setq pos-url (* 2 ct)))
1149 ((and (>= p-uid 0) (= (nth i p-list) p-uid))
1150 (setq ct (+ ct 1))
1151 (setq pos-uid (* 2 ct)))) )
1135 (mapc (lambda (ij) 1152 (mapc (lambda (ij)
1136 (setq s (icalendar--rris (car ij) (cadr ij) s t t))) 1153 (setq s (icalendar--rris (car ij) (cadr ij) s t t)))
1137 (list 1154 (list
@@ -1149,13 +1166,15 @@ Returns an alist."
1149 (list "%t" 1166 (list "%t"
1150 (concat "\\(" icalendar-import-format-status "\\)??")) 1167 (concat "\\(" icalendar-import-format-status "\\)??"))
1151 (list "%u" 1168 (list "%u"
1152 (concat "\\(" icalendar-import-format-url "\\)??")))) 1169 (concat "\\(" icalendar-import-format-url "\\)??"))
1170 (list "%U"
1171 (concat "\\(" icalendar-import-format-uid "\\)??"))))
1153 ;; Need the \' regexp in order to detect multi-line items 1172 ;; Need the \' regexp in order to detect multi-line items
1154 (setq s (concat "\\`" 1173 (setq s (concat "\\`"
1155 (icalendar--rris "%s" "\\(.*?\\)" s nil t) 1174 (icalendar--rris "%s" "\\(.*?\\)" s nil t)
1156 "\\'")) 1175 "\\'"))
1157 (if (string-match s summary-and-rest) 1176 (if (string-match s summary-and-rest)
1158 (let (cla des loc org sta sum url) 1177 (let (cla des loc org sta sum url uid)
1159 (if (and pos-sum (match-beginning pos-sum)) 1178 (if (and pos-sum (match-beginning pos-sum))
1160 (setq sum (substring summary-and-rest 1179 (setq sum (substring summary-and-rest
1161 (match-beginning pos-sum) 1180 (match-beginning pos-sum)
@@ -1184,13 +1203,18 @@ Returns an alist."
1184 (setq url (substring summary-and-rest 1203 (setq url (substring summary-and-rest
1185 (match-beginning pos-url) 1204 (match-beginning pos-url)
1186 (match-end pos-url)))) 1205 (match-end pos-url))))
1206 (if (and pos-uid (match-beginning pos-uid))
1207 (setq uid (substring summary-and-rest
1208 (match-beginning pos-uid)
1209 (match-end pos-uid))))
1187 (list (if cla (cons 'cla cla) nil) 1210 (list (if cla (cons 'cla cla) nil)
1188 (if des (cons 'des des) nil) 1211 (if des (cons 'des des) nil)
1189 (if loc (cons 'loc loc) nil) 1212 (if loc (cons 'loc loc) nil)
1190 (if org (cons 'org org) nil) 1213 (if org (cons 'org org) nil)
1191 (if sta (cons 'sta sta) nil) 1214 (if sta (cons 'sta sta) nil)
1192 ;;(if sum (cons 'sum sum) nil) 1215 ;;(if sum (cons 'sum sum) nil)
1193 (if url (cons 'url url) nil)))))))) 1216 (if url (cons 'url url) nil)
1217 (if uid (cons 'uid uid) nil))))))))
1194 1218
1195;; subroutines for icalendar-export-region 1219;; subroutines for icalendar-export-region
1196(defun icalendar--convert-ordinary-to-ical (nonmarker entry-main) 1220(defun icalendar--convert-ordinary-to-ical (nonmarker entry-main)
@@ -1864,6 +1888,7 @@ buffer `*icalendar-errors*'."
1864 (if (functionp icalendar-import-format) 1888 (if (functionp icalendar-import-format)
1865 (funcall icalendar-import-format event) 1889 (funcall icalendar-import-format event)
1866 (let ((string icalendar-import-format) 1890 (let ((string icalendar-import-format)
1891 (case-fold-search nil)
1867 (conversion-list 1892 (conversion-list
1868 '(("%c" CLASS icalendar-import-format-class) 1893 '(("%c" CLASS icalendar-import-format-class)
1869 ("%d" DESCRIPTION icalendar-import-format-description) 1894 ("%d" DESCRIPTION icalendar-import-format-description)
@@ -1871,7 +1896,8 @@ buffer `*icalendar-errors*'."
1871 ("%o" ORGANIZER icalendar-import-format-organizer) 1896 ("%o" ORGANIZER icalendar-import-format-organizer)
1872 ("%s" SUMMARY icalendar-import-format-summary) 1897 ("%s" SUMMARY icalendar-import-format-summary)
1873 ("%t" STATUS icalendar-import-format-status) 1898 ("%t" STATUS icalendar-import-format-status)
1874 ("%u" URL icalendar-import-format-url)))) 1899 ("%u" URL icalendar-import-format-url)
1900 ("%U" UID icalendar-import-format-uid))))
1875 ;; convert the specifiers in the format string 1901 ;; convert the specifiers in the format string
1876 (mapc (lambda (i) 1902 (mapc (lambda (i)
1877 (let* ((spec (car i)) 1903 (let* ((spec (car i))
diff --git a/test/ChangeLog b/test/ChangeLog
index ba6162ca241..f5fa81f4a5a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,15 @@
12012-05-29 Ulf Jasper <ulf.jasper@web.de>
2
3 * automated/icalendar-tests.el (icalendar-tests--test-import):
4 Include UID in import tests (Bug#11525).
5 (icalendar-import-non-recurring, icalendar-import-rrule)
6 (icalendar-import-duration, icalendar-import-bug-6766): Adjust to
7 UID-import change.
8 (icalendar-import-with-uid): New.
9 (icalendar-tests--test-cycle, icalendar-tests--do-test-cycle):
10 Include UID in cycle tests.
11 (icalendar-cycle, icalendar-real-world): UID-import change.
12
12012-05-21 Glenn Morris <rgm@gnu.org> 132012-05-21 Glenn Morris <rgm@gnu.org>
2 14
3 * automated/Makefile.in (setwins): Scrap superfluous subshell. 15 * automated/Makefile.in (setwins): Scrap superfluous subshell.
diff --git a/test/automated/icalendar-tests.el b/test/automated/icalendar-tests.el
index 503ea22d2b8..dbf262d9f77 100644
--- a/test/automated/icalendar-tests.el
+++ b/test/automated/icalendar-tests.el
@@ -682,7 +682,7 @@ Argument EXPECTED-AMERICAN expected american style diary string."
682 (unless (eq (char-before) ?\n) 682 (unless (eq (char-before) ?\n)
683 (insert "\n")) 683 (insert "\n"))
684 (insert "END:VEVENT\nEND:VCALENDAR\n")) 684 (insert "END:VEVENT\nEND:VCALENDAR\n"))
685 (let ((icalendar-import-format "%s%d%l%o%t%u%c") 685 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
686 (icalendar-import-format-summary "%s") 686 (icalendar-import-format-summary "%s")
687 (icalendar-import-format-location "\n Location: %s") 687 (icalendar-import-format-location "\n Location: %s")
688 (icalendar-import-format-description "\n Desc: %s") 688 (icalendar-import-format-description "\n Desc: %s")
@@ -690,6 +690,7 @@ Argument EXPECTED-AMERICAN expected american style diary string."
690 (icalendar-import-format-status "\n Status: %s") 690 (icalendar-import-format-status "\n Status: %s")
691 (icalendar-import-format-url "\n URL: %s") 691 (icalendar-import-format-url "\n URL: %s")
692 (icalendar-import-format-class "\n Class: %s") 692 (icalendar-import-format-class "\n Class: %s")
693 (icalendar-import-format-uid "\n UID: %s")
693 calendar-date-style) 694 calendar-date-style)
694 (when expected-iso 695 (when expected-iso
695 (setq calendar-date-style 'iso) 696 (setq calendar-date-style 'iso)
@@ -751,14 +752,17 @@ DTSTAMP:20031103T011641Z
751 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien 752 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
752 Status: TENTATIVE 753 Status: TENTATIVE
753 Class: PRIVATE 754 Class: PRIVATE
755 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
754" 756"
755 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien 757 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
756 Status: TENTATIVE 758 Status: TENTATIVE
757 Class: PRIVATE 759 Class: PRIVATE
760 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
758" 761"
759 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien 762 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
760 Status: TENTATIVE 763 Status: TENTATIVE
761 Class: PRIVATE 764 Class: PRIVATE
765 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
762") 766")
763 (icalendar-tests--test-import 767 (icalendar-tests--test-import
764 "UID 768 "UID
@@ -782,13 +786,16 @@ LAST-MODIFIED
782" 786"
783 "&2004/11/23 14:00-14:30 folded summary 787 "&2004/11/23 14:00-14:30 folded summary
784 Status: TENTATIVE 788 Status: TENTATIVE
785 Class: PRIVATE\n" 789 Class: PRIVATE
790 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
786 "&23/11/2004 14:00-14:30 folded summary 791 "&23/11/2004 14:00-14:30 folded summary
787 Status: TENTATIVE 792 Status: TENTATIVE
788 Class: PRIVATE\n" 793 Class: PRIVATE
794 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
789 "&11/23/2004 14:00-14:30 folded summary 795 "&11/23/2004 14:00-14:30 folded summary
790 Status: TENTATIVE 796 Status: TENTATIVE
791 Class: PRIVATE\n") 797 Class: PRIVATE
798 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
792 799
793 (icalendar-tests--test-import 800 (icalendar-tests--test-import
794 "UID 801 "UID
@@ -810,13 +817,16 @@ DTSTAMP
810" 817"
811 "&2004/11/23 14:45-15:45 another example 818 "&2004/11/23 14:45-15:45 another example
812 Status: TENTATIVE 819 Status: TENTATIVE
813 Class: PRIVATE\n" 820 Class: PRIVATE
821 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
814 "&23/11/2004 14:45-15:45 another example 822 "&23/11/2004 14:45-15:45 another example
815 Status: TENTATIVE 823 Status: TENTATIVE
816 Class: PRIVATE\n" 824 Class: PRIVATE
825 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
817 "&11/23/2004 14:45-15:45 another example 826 "&11/23/2004 14:45-15:45 another example
818 Status: TENTATIVE 827 Status: TENTATIVE
819 Class: PRIVATE\n")) 828 Class: PRIVATE
829 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
820 830
821(ert-deftest icalendar-import-rrule () 831(ert-deftest icalendar-import-rrule ()
822 (icalendar-tests--test-import 832 (icalendar-tests--test-import
@@ -879,7 +889,6 @@ RRULE:FREQ=MONTHLY;UNTIL=20050819;
879 "DTSTART;VALUE=DATE:20040815 889 "DTSTART;VALUE=DATE:20040815
880DTEND;VALUE=DATE:20040816 890DTEND;VALUE=DATE:20040816
881SUMMARY:Maria Himmelfahrt 891SUMMARY:Maria Himmelfahrt
882UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
883RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8 892RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
884" 893"
885 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n" 894 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
@@ -982,11 +991,14 @@ SEQUENCE:1
982CREATED:20041127T183329 991CREATED:20041127T183329
983" 992"
984 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub 993 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
985 Class: PUBLIC\n" 994 Class: PUBLIC
995 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
986 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub 996 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
987 Class: PUBLIC\n" 997 Class: PUBLIC
998 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
988 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub 999 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
989 Class: PUBLIC\n")) 1000 Class: PUBLIC
1001 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
990 1002
991(ert-deftest icalendar-import-bug-6766 () 1003(ert-deftest icalendar-import-bug-6766 ()
992 ;;bug#6766 -- multiple byday values in a weekly rrule 1004 ;;bug#6766 -- multiple byday values in a weekly rrule
@@ -1016,20 +1028,26 @@ UID:8814e3f9-7482-408f-996c-3bfe486a1263
1016"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum 1028"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1017 Status: CONFIRMED 1029 Status: CONFIRMED
1018 Class: PUBLIC 1030 Class: PUBLIC
1031 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1019&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking 1032&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1020 Class: PUBLIC 1033 Class: PUBLIC
1034 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1021" 1035"
1022"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum 1036"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1023 Status: CONFIRMED 1037 Status: CONFIRMED
1024 Class: PUBLIC 1038 Class: PUBLIC
1039 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1025&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking 1040&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1026 Class: PUBLIC 1041 Class: PUBLIC
1042 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1027" 1043"
1028"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum 1044"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1029 Status: CONFIRMED 1045 Status: CONFIRMED
1030 Class: PUBLIC 1046 Class: PUBLIC
1047 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1031&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking 1048&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1032 Class: PUBLIC 1049 Class: PUBLIC
1050 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1033")) 1051"))
1034 1052
1035(ert-deftest icalendar-import-multiple-vcalendars () 1053(ert-deftest icalendar-import-multiple-vcalendars ()
@@ -1074,6 +1092,17 @@ END:VCALENDAR
1074 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n" 1092 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
1075 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n")) 1093 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
1076 1094
1095(ert-deftest icalendar-import-with-uid ()
1096 "Perform import test with uid."
1097 (icalendar-tests--test-import
1098 "UID:1234567890uid
1099SUMMARY:non-recurring
1100DTSTART;VALUE=DATE-TIME:20030919T090000
1101DTEND;VALUE=DATE-TIME:20030919T113000"
1102 "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1103 "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1104 "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
1105
1077;; ====================================================================== 1106;; ======================================================================
1078;; Cycle 1107;; Cycle
1079;; ====================================================================== 1108;; ======================================================================
@@ -1089,14 +1118,15 @@ Argument INPUT icalendar event string."
1089 (unless (eq (char-before) ?\n) 1118 (unless (eq (char-before) ?\n)
1090 (insert "\n")) 1119 (insert "\n"))
1091 (insert "END:VEVENT\nEND:VCALENDAR\n")) 1120 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1092 (let ((icalendar-import-format "%s%d%l%o%t%u%c") 1121 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
1093 (icalendar-import-format-summary "%s") 1122 (icalendar-import-format-summary "%s")
1094 (icalendar-import-format-location "\n Location: %s") 1123 (icalendar-import-format-location "\n Location: %s")
1095 (icalendar-import-format-description "\n Desc: %s") 1124 (icalendar-import-format-description "\n Desc: %s")
1096 (icalendar-import-format-organizer "\n Organizer: %s") 1125 (icalendar-import-format-organizer "\n Organizer: %s")
1097 (icalendar-import-format-status "\n Status: %s") 1126 (icalendar-import-format-status "\n Status: %s")
1098 (icalendar-import-format-url "\n URL: %s") 1127 (icalendar-import-format-url "\n URL: %s")
1099 (icalendar-import-format-class "\n Class: %s")) 1128 (icalendar-import-format-class "\n Class: %s")
1129 (icalendar-import-format-class "\n UID: %s"))
1100 (dolist (calendar-date-style '(iso european american)) 1130 (dolist (calendar-date-style '(iso european american))
1101 (icalendar-tests--do-test-cycle))))) 1131 (icalendar-tests--do-test-cycle)))))
1102 1132
@@ -1120,8 +1150,8 @@ Argument INPUT icalendar event string."
1120 (save-excursion 1150 (save-excursion
1121 (find-file temp-ics) 1151 (find-file temp-ics)
1122 (goto-char (point-min)) 1152 (goto-char (point-min))
1123 (when (re-search-forward "\nUID:.*\n" nil t) 1153 ;;(when (re-search-forward "\nUID:.*\n" nil t)
1124 (replace-match "\n")) 1154 ;;(replace-match "\n"))
1125 (let ((cycled (buffer-substring-no-properties (point-min) (point-max)))) 1155 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1126 (should (string= org-input cycled))))) 1156 (should (string= org-input cycled)))))
1127 ;; clean up 1157 ;; clean up
@@ -1134,14 +1164,17 @@ Argument INPUT icalendar event string."
1134 (delete-file temp-ics)))) 1164 (delete-file temp-ics))))
1135 1165
1136(ert-deftest icalendar-cycle () 1166(ert-deftest icalendar-cycle ()
1137 "Perform cycling tests." 1167 "Perform cycling tests.
1168Take care to avoid auto-generated UIDs here."
1138 (icalendar-tests--test-cycle 1169 (icalendar-tests--test-cycle
1139 "DTSTART;VALUE=DATE-TIME:20030919T090000 1170 "UID:dummyuid
1171DTSTART;VALUE=DATE-TIME:20030919T090000
1140DTEND;VALUE=DATE-TIME:20030919T113000 1172DTEND;VALUE=DATE-TIME:20030919T113000
1141SUMMARY:Cycletest 1173SUMMARY:Cycletest
1142") 1174")
1143 (icalendar-tests--test-cycle 1175 (icalendar-tests--test-cycle
1144 "DTSTART;VALUE=DATE-TIME:20030919T090000 1176 "UID:blah
1177DTSTART;VALUE=DATE-TIME:20030919T090000
1145DTEND;VALUE=DATE-TIME:20030919T113000 1178DTEND;VALUE=DATE-TIME:20030919T113000
1146SUMMARY:Cycletest 1179SUMMARY:Cycletest
1147DESCRIPTION:beschreibung! 1180DESCRIPTION:beschreibung!
@@ -1149,7 +1182,8 @@ LOCATION:nowhere
1149ORGANIZER:ulf 1182ORGANIZER:ulf
1150") 1183")
1151 (icalendar-tests--test-cycle 1184 (icalendar-tests--test-cycle
1152 "DTSTART;VALUE=DATE:19190909 1185 "UID:4711
1186DTSTART;VALUE=DATE:19190909
1153DTEND;VALUE=DATE:19190910 1187DTEND;VALUE=DATE:19190910
1154RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09 1188RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1155SUMMARY:and diary-anniversary 1189SUMMARY:and diary-anniversary
@@ -1222,12 +1256,14 @@ END:VCALENDAR"
1222 Location: Cccc 1256 Location: Cccc
1223 Organizer: MAILTO:aaaaaaa@aaaaaaa.com 1257 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1224 Status: CONFIRMED 1258 Status: CONFIRMED
1259 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1225" 1260"
1226 "&5/9/2003 10:30-15:30 On-Site Interview 1261 "&5/9/2003 10:30-15:30 On-Site Interview
1227 Desc: 10:30am - Blah 1262 Desc: 10:30am - Blah
1228 Location: Cccc 1263 Location: Cccc
1229 Organizer: MAILTO:aaaaaaa@aaaaaaa.com 1264 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1230 Status: CONFIRMED 1265 Status: CONFIRMED
1266 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1231") 1267")
1232 1268
1233 ;; 2003-06-18 a 1269 ;; 2003-06-18 a
@@ -1268,12 +1304,14 @@ END:VALARM"
1268 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below) 1304 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1269 Organizer: MAILTO:xxx@xxxxx.com 1305 Organizer: MAILTO:xxx@xxxxx.com
1270 Status: CONFIRMED 1306 Status: CONFIRMED
1307 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1271" 1308"
1272 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX 1309 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1273 Desc: 753 Zeichen hier radiert 1310 Desc: 753 Zeichen hier radiert
1274 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below) 1311 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1275 Organizer: MAILTO:xxx@xxxxx.com 1312 Organizer: MAILTO:xxx@xxxxx.com
1276 Status: CONFIRMED 1313 Status: CONFIRMED
1314 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1277") 1315")
1278 ;; 2003-06-18 b -- uses timezone 1316 ;; 2003-06-18 b -- uses timezone
1279 (icalendar-tests--test-import 1317 (icalendar-tests--test-import
@@ -1338,12 +1376,14 @@ END:VCALENDAR"
1338 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below) 1376 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1339 Organizer: MAILTO:bbb@bbbbb.com 1377 Organizer: MAILTO:bbb@bbbbb.com
1340 Status: CONFIRMED 1378 Status: CONFIRMED
1379 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1341" 1380"
1342 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15 1381 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1343 Desc: Viele Zeichen standen hier früher 1382 Desc: Viele Zeichen standen hier früher
1344 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below) 1383 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1345 Organizer: MAILTO:bbb@bbbbb.com 1384 Organizer: MAILTO:bbb@bbbbb.com
1346 Status: CONFIRMED 1385 Status: CONFIRMED
1386 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1347") 1387")
1348 ;; export 2004-10-28 block entries 1388 ;; export 2004-10-28 block entries
1349 (icalendar-tests--test-export 1389 (icalendar-tests--test-export
@@ -1567,8 +1607,6 @@ VERSION
1567PRODID 1607PRODID
1568 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN 1608 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1569BEGIN:VEVENT 1609BEGIN:VEVENT
1570UID
1571 :04979712-3902-11d9-93dd-8f9f4afe08da
1572SUMMARY 1610SUMMARY
1573 :Jjjjj & Wwwww 1611 :Jjjjj & Wwwww
1574STATUS 1612STATUS
@@ -1587,8 +1625,6 @@ LAST-MODIFIED
1587 :20041118T013640Z 1625 :20041118T013640Z
1588END:VEVENT 1626END:VEVENT
1589BEGIN:VEVENT 1627BEGIN:VEVENT
1590UID
1591 :6161a312-3902-11d9-b512-f764153bb28b
1592SUMMARY 1628SUMMARY
1593 :BB Aaaaaaaa Bbbbb 1629 :BB Aaaaaaaa Bbbbb
1594STATUS 1630STATUS
@@ -1605,8 +1641,6 @@ DTSTAMP
1605 :20041118T013641Z 1641 :20041118T013641Z
1606END:VEVENT 1642END:VEVENT
1607BEGIN:VEVENT 1643BEGIN:VEVENT
1608UID
1609 :943a4d7e-3902-11d9-9ce7-c9addeadf928
1610SUMMARY 1644SUMMARY
1611 :Hhhhhhhh 1645 :Hhhhhhhh
1612STATUS 1646STATUS
@@ -1623,8 +1657,6 @@ DTSTAMP
1623 :20041118T013831Z 1657 :20041118T013831Z
1624END:VEVENT 1658END:VEVENT
1625BEGIN:VEVENT 1659BEGIN:VEVENT
1626UID
1627 :fe53615e-3902-11d9-9dd8-9d38a155bf41
1628SUMMARY 1660SUMMARY
1629 :MMM Aaaaaaaaa 1661 :MMM Aaaaaaaaa
1630STATUS 1662STATUS
@@ -1645,8 +1677,6 @@ DTSTAMP
1645 :20041118T014117Z 1677 :20041118T014117Z
1646END:VEVENT 1678END:VEVENT
1647BEGIN:VEVENT 1679BEGIN:VEVENT
1648UID
1649 :87c928ee-3901-11d9-b21f-b45042155024
1650SUMMARY 1680SUMMARY
1651 :Rrrr/Cccccc ii Aaaaaaaa 1681 :Rrrr/Cccccc ii Aaaaaaaa
1652DESCRIPTION 1682DESCRIPTION
@@ -1669,8 +1699,6 @@ LAST-MODIFIED
1669 :20041118T014203Z 1699 :20041118T014203Z
1670END:VEVENT 1700END:VEVENT
1671BEGIN:VEVENT 1701BEGIN:VEVENT
1672UID
1673 :e8f331ae-3902-11d9-9948-dfdcb66a2872
1674SUMMARY 1702SUMMARY
1675 :Wwww aa hhhh 1703 :Wwww aa hhhh
1676STATUS 1704STATUS
@@ -1790,11 +1818,13 @@ DTSTAMP
1790 Desc: abcdef 1818 Desc: abcdef
1791 Status: CONFIRMED 1819 Status: CONFIRMED
1792 Class: PRIVATE 1820 Class: PRIVATE
1821 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
1793" 1822"
1794 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day 1823 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
1795 Desc: abcdef 1824 Desc: abcdef
1796 Status: CONFIRMED 1825 Status: CONFIRMED
1797 Class: PRIVATE 1826 Class: PRIVATE
1827 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
1798") 1828")
1799 1829
1800 ;; 2005-03-01 lt 1830 ;; 2005-03-01 lt
@@ -1805,8 +1835,10 @@ UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
1805DTSTAMP:20050118T210335Z 1835DTSTAMP:20050118T210335Z
1806DURATION:P7D" 1836DURATION:P7D"
1807 nil 1837 nil
1808 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n" 1838 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
1809 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n") 1839 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
1840 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
1841 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
1810 1842
1811 ;; 2005-03-23 lt 1843 ;; 2005-03-23 lt
1812 (icalendar-tests--test-export 1844 (icalendar-tests--test-export