diff options
| author | Ulf Jasper | 2014-11-16 17:23:45 +0100 |
|---|---|---|
| committer | Ulf Jasper | 2014-11-16 17:23:45 +0100 |
| commit | 7261b4d9b2f35c3e520b488a8ba3cfde30f84a24 (patch) | |
| tree | b50d3087acf6dca06ce807bcfa79d9ab7d5961bc | |
| parent | a97fd0eb8d043170601808e6e5a349e6981c30c4 (diff) | |
| download | emacs-7261b4d9b2f35c3e520b488a8ba3cfde30f84a24.tar.gz emacs-7261b4d9b2f35c3e520b488a8ba3cfde30f84a24.zip | |
icalendar: fix issues regarding timezones without dst
* lisp/calendar/icalendar.el (icalendar--convert-tz-offset): Return
complete cons when offsets of standard time and daylight saving
time are equal.
(icalendar-export-region): Fix unbound variable warning.
* test/automated/icalendar-tests.el (icalendar--parse-vtimezone): Add
testcase where offsets of standard time and daylight saving time
are equal.
(icalendar-real-world): Fix error in test case. Expected result
was wrong when offsets of standard time and daylight saving time
were equal.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/calendar/icalendar.el | 17 | ||||
| -rw-r--r-- | test/ChangeLog | 9 | ||||
| -rw-r--r-- | test/automated/icalendar-tests.el | 25 |
4 files changed, 50 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bdf73e827d1..9d22d7609e2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-11-16 Ulf Jasper <ulf.jasper@web.de> | ||
| 2 | |||
| 3 | * calendar/icalendar.el (icalendar--convert-tz-offset): Return | ||
| 4 | complete cons when offsets of standard time and daylight saving | ||
| 5 | time are equal. | ||
| 6 | (icalendar-export-region): Fix unbound variable warning. | ||
| 7 | |||
| 1 | 2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org> | 8 | 2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org> |
| 2 | 9 | ||
| 3 | * progmodes/python.el (run-python): Allow CMD to be optional and | 10 | * progmodes/python.el (run-python): Allow CMD to be optional and |
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index b024a38f809..9dba6ff2dcf 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -509,15 +509,19 @@ The strings are suitable for assembling into a TZ variable." | |||
| 509 | ":" | 509 | ":" |
| 510 | (substring offsetto 3 5)) | 510 | (substring offsetto 3 5)) |
| 511 | ;; The start time. | 511 | ;; The start time. |
| 512 | (unless no-dst | 512 | (let* ((day (if no-dst |
| 513 | (let* ((day (icalendar--get-weekday-number (substring byday -2))) | 513 | 1 |
| 514 | (week (if (eq day -1) | 514 | (icalendar--get-weekday-number (substring byday -2)))) |
| 515 | (week (if no-dst | ||
| 516 | "1" | ||
| 517 | (if (eq day -1) | ||
| 515 | byday | 518 | byday |
| 516 | (substring byday 0 -2)))) | 519 | (substring byday 0 -2))))) |
| 517 | ;; "Translate" the iCalendar way to specify the last | 520 | ;; "Translate" the iCalendar way to specify the last |
| 518 | ;; (sun|mon|...)day in month to the tzset way. | 521 | ;; (sun|mon|...)day in month to the tzset way. |
| 519 | (if (string= week "-1") ; last day as iCalendar calls it | 522 | (if (string= week "-1") ; last day as iCalendar calls it |
| 520 | (setq week "5")) ; last day as tzset calls it | 523 | (setq week "5")) ; last day as tzset calls it |
| 524 | (when no-dst (setq bymonth "1")) | ||
| 521 | (concat "M" bymonth "." week "." (if (eq day -1) "0" | 525 | (concat "M" bymonth "." week "." (if (eq day -1) "0" |
| 522 | (int-to-string day)) | 526 | (int-to-string day)) |
| 523 | ;; Start time. | 527 | ;; Start time. |
| @@ -526,7 +530,7 @@ The strings are suitable for assembling into a TZ variable." | |||
| 526 | ":" | 530 | ":" |
| 527 | (substring dtstart -4 -2) | 531 | (substring dtstart -4 -2) |
| 528 | ":" | 532 | ":" |
| 529 | (substring dtstart -2)))))))))) | 533 | (substring dtstart -2))))))))) |
| 530 | 534 | ||
| 531 | (defun icalendar--parse-vtimezone (alist) | 535 | (defun icalendar--parse-vtimezone (alist) |
| 532 | "Turn a VTIMEZONE ALIST into a cons (ID . TZ-STRING). | 536 | "Turn a VTIMEZONE ALIST into a cons (ID . TZ-STRING). |
| @@ -1025,7 +1029,8 @@ FExport diary data into iCalendar file: ") | |||
| 1025 | (found-error nil) | 1029 | (found-error nil) |
| 1026 | (nonmarker (concat "^" (regexp-quote diary-nonmarking-symbol) | 1030 | (nonmarker (concat "^" (regexp-quote diary-nonmarking-symbol) |
| 1027 | "?")) | 1031 | "?")) |
| 1028 | (other-elements nil)) | 1032 | (other-elements nil) |
| 1033 | (cns-cons-or-list nil)) | ||
| 1029 | ;; prepare buffer with error messages | 1034 | ;; prepare buffer with error messages |
| 1030 | (save-current-buffer | 1035 | (save-current-buffer |
| 1031 | (set-buffer (get-buffer-create "*icalendar-errors*")) | 1036 | (set-buffer (get-buffer-create "*icalendar-errors*")) |
diff --git a/test/ChangeLog b/test/ChangeLog index e0e04bc262c..4a6f0059344 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-11-16 Ulf Jasper <ulf.jasper@web.de> | ||
| 2 | |||
| 3 | * automated/icalendar-tests.el (icalendar--parse-vtimezone): Add | ||
| 4 | testcase where offsets of standard time and daylight saving time | ||
| 5 | are equal. | ||
| 6 | (icalendar-real-world): Fix error in test case. Expected result | ||
| 7 | was wrong when offsets of standard time and daylight saving time | ||
| 8 | were equal. | ||
| 9 | |||
| 1 | 2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org> | 10 | 2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org> |
| 2 | 11 | ||
| 3 | * automated/python-tests.el | 12 | * automated/python-tests.el |
diff --git a/test/automated/icalendar-tests.el b/test/automated/icalendar-tests.el index a6a5da2ff57..23afb14792d 100644 --- a/test/automated/icalendar-tests.el +++ b/test/automated/icalendar-tests.el | |||
| @@ -232,6 +232,27 @@ END:VTIMEZONE | |||
| 232 | (should (string= "anothername, with a comma" (car result))) | 232 | (should (string= "anothername, with a comma" (car result))) |
| 233 | (message (cdr result)) | 233 | (message (cdr result)) |
| 234 | (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" | 234 | (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" |
| 235 | (cdr result))) | ||
| 236 | ;; offsetfrom = offsetto | ||
| 237 | (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE | ||
| 238 | TZID:Kolkata\, Chennai\, Mumbai\, New Delhi | ||
| 239 | X-MICROSOFT-CDO-TZID:23 | ||
| 240 | BEGIN:STANDARD | ||
| 241 | DTSTART:16010101T000000 | ||
| 242 | TZOFFSETFROM:+0530 | ||
| 243 | TZOFFSETTO:+0530 | ||
| 244 | END:STANDARD | ||
| 245 | BEGIN:DAYLIGHT | ||
| 246 | DTSTART:16010101T000000 | ||
| 247 | TZOFFSETFROM:+0530 | ||
| 248 | TZOFFSETTO:+0530 | ||
| 249 | END:DAYLIGHT | ||
| 250 | END:VTIMEZONE | ||
| 251 | ")) | ||
| 252 | (setq result (icalendar--parse-vtimezone vtimezone)) | ||
| 253 | (should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result))) | ||
| 254 | (message (cdr result)) | ||
| 255 | (should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00" | ||
| 235 | (cdr result))))) | 256 | (cdr result))))) |
| 236 | 257 | ||
| 237 | (ert-deftest icalendar--convert-ordinary-to-ical () | 258 | (ert-deftest icalendar--convert-ordinary-to-ical () |
| @@ -1389,14 +1410,14 @@ END:VALARM | |||
| 1389 | END:VEVENT | 1410 | END:VEVENT |
| 1390 | END:VCALENDAR" | 1411 | END:VCALENDAR" |
| 1391 | nil | 1412 | nil |
| 1392 | "&9/5/2003 10:30-15:30 On-Site Interview | 1413 | "&9/5/2003 07:00-12:00 On-Site Interview |
| 1393 | Desc: 10:30am - Blah | 1414 | Desc: 10:30am - Blah |
| 1394 | Location: Cccc | 1415 | Location: Cccc |
| 1395 | Organizer: MAILTO:aaaaaaa@aaaaaaa.com | 1416 | Organizer: MAILTO:aaaaaaa@aaaaaaa.com |
| 1396 | Status: CONFIRMED | 1417 | Status: CONFIRMED |
| 1397 | UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9 | 1418 | UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9 |
| 1398 | " | 1419 | " |
| 1399 | "&5/9/2003 10:30-15:30 On-Site Interview | 1420 | "&5/9/2003 07:00-12:00 On-Site Interview |
| 1400 | Desc: 10:30am - Blah | 1421 | Desc: 10:30am - Blah |
| 1401 | Location: Cccc | 1422 | Location: Cccc |
| 1402 | Organizer: MAILTO:aaaaaaa@aaaaaaa.com | 1423 | Organizer: MAILTO:aaaaaaa@aaaaaaa.com |