emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs lisp/ChangeLog lisp/calendar/icalendar.el...


From: Ulf Jasper
Subject: [Emacs-diffs] emacs lisp/ChangeLog lisp/calendar/icalendar.el...
Date: Fri, 18 Dec 2009 19:35:19 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Ulf Jasper <u11>        09/12/18 19:35:19

Modified files:
        lisp           : ChangeLog 
        lisp/calendar  : icalendar.el 
        test           : ChangeLog icalendar-testsuite.el 

Log message:
        Fixed timezone handling problem in icalendar.el.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16914&r2=1.16915
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/calendar/icalendar.el?cvsroot=emacs&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/emacs/test/ChangeLog?cvsroot=emacs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/emacs/test/icalendar-testsuite.el?cvsroot=emacs&r1=1.6&r2=1.7

Patches:
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16914
retrieving revision 1.16915
diff -u -b -r1.16914 -r1.16915
--- lisp/ChangeLog      17 Dec 2009 13:18:03 -0000      1.16914
+++ lisp/ChangeLog      18 Dec 2009 19:35:14 -0000      1.16915
@@ -1,3 +1,11 @@
+2009-12-18  Ulf Jasper  <address@hidden>
+
+       * calendar/icalendar.el (icalendar--convert-tz-offset): Fixed
+       timezone names.
+       (icalendar--convert-tz-offset): Fixed the "last-day-problem".
+       (icalendar--add-diary-entry): Remove the trailing blank that
+       diary-make-entry inserts.
+
 2009-12-17  Michael Albinus  <address@hidden>
 
        Make `file-expand-wildcards' work for remote files.

Index: lisp/calendar/icalendar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/icalendar.el,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- lisp/calendar/icalendar.el  21 Aug 2009 15:09:45 -0000      1.38
+++ lisp/calendar/icalendar.el  18 Dec 2009 19:35:18 -0000      1.39
@@ -454,7 +454,7 @@
            (cons
             (concat
              ;; Fake a name.
-             (if dst-p "(DST?)" "(STD?)")
+             (if dst-p "DST" "STD")
              ;; For TZ, OFFSET is added to the local time.  So,
              ;; invert the values.
              (if (eq (aref offset 0) ?-) "+" "-")
@@ -466,6 +466,10 @@
                    (week (if (eq day -1)
                              byday
                            (substring byday 0 -2))))
+               ;; "Translate" the icalendar way to specify the last
+               ;; (sun|mon|...)day in month to the tzset way.
+               (if (string= week "-1")  ; last day as icalendar calls it
+                   (setq week "5"))     ; last day as tzset calls it
               (concat "M" bymonth "." week "." (if (eq day -1) "0"
                                                  (int-to-string day))
                       ;; Start time.
@@ -2241,6 +2245,12 @@
                    'diary-make-entry
                  'make-diary-entry)
                string non-marking diary-file)))
+  ;; Würgaround to remove the trailing blank char
+  (save-excursion
+    (set-buffer (find-file diary-file))
+    (goto-char (point-max))
+    (if (= (char-before) ? )
+        (delete-char -1)))
   ;; return diary-file in case it has been changed interactively
   diary-file)
 

Index: test/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/test/ChangeLog,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- test/ChangeLog      30 Sep 2009 02:28:17 -0000      1.15
+++ test/ChangeLog      18 Dec 2009 19:35:18 -0000      1.16
@@ -1,3 +1,15 @@
+2009-12-18  Ulf Jasper  <address@hidden>
+
+       * icalendar-testsuite.el
+       (icalendar-testsuite--run-function-tests): Added
+       icalendar-testsuite--test-parse-vtimezone.
+       (icalendar-testsuite--test-parse-vtimezone): New.
+       (icalendar-testsuite--do-test-cycle): Doc changes.
+       (icalendar-testsuite--run-real-world-tests): Removed trailing
+       whitespace -- see change of icalendar--add-diary-entry in
+       icalendar.el.
+       (icalendar-testsuite--run-cycle-tests): Re-enabled all tests.
+
 2009-09-30  Glenn Morris  <address@hidden>
 
        * cedet/semantic-utest-c.el: Relicense under GPLv3+.

Index: test/icalendar-testsuite.el
===================================================================
RCS file: /sources/emacs/emacs/test/icalendar-testsuite.el,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- test/icalendar-testsuite.el 25 Jan 2009 13:38:17 -0000      1.6
+++ test/icalendar-testsuite.el 18 Dec 2009 19:35:18 -0000      1.7
@@ -53,7 +53,8 @@
   (icalendar-testsuite--test-datetime-to-diary-date)
   (icalendar-testsuite--test-diarytime-to-isotime)
   (icalendar-testsuite--test-calendar-style)
-  (icalendar-testsuite--test-create-uid))
+  (icalendar-testsuite--test-create-uid)
+  (icalendar-testsuite--test-parse-vtimezone))
 
 (defun icalendar-testsuite--test-format-ical-event ()
   "Test `icalendar--format-ical-event'."
@@ -272,6 +273,48 @@
                       (icalendar--create-uid entry-full contents)))
     ))
 
+(defun icalendar-testsuite--test-parse-vtimezone ()
+  (let (vtimezone result)
+    (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE
+TZID:thename
+BEGIN:STANDARD
+DTSTART:16010101T040000
+TZOFFSETFROM:+0300
+TZOFFSETTO:+0200
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:16010101T030000
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0300
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
+END:DAYLIGHT
+END:VTIMEZONE
+"))
+    (setq result (icalendar--parse-vtimezone vtimezone))
+    (assert (string= "thename" (car result)))
+    (message (cdr result))
+    (assert (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" 
(cdr result)))
+    (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE
+TZID:anothername
+BEGIN:STANDARD
+DTSTART:16010101T040000
+TZOFFSETFROM:+0300
+TZOFFSETTO:+0200
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:16010101T030000
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0300
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
+END:DAYLIGHT
+END:VTIMEZONE
+"))
+    (setq result (icalendar--parse-vtimezone vtimezone))
+    (assert (string= "anothername" (car result)))
+    (message (cdr result))
+    (assert (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" 
(cdr result)))))
 
 ;; ======================================================================
 ;; Test methods for exporting from diary to icalendar
@@ -455,10 +498,16 @@
   (let ((temp-diary (make-temp-file "icalendar-test-diary"))
         (temp-ics (make-temp-file "icalendar-test-ics"))
         (org-input (buffer-substring-no-properties (point-min) (point-max))))
+
+    ;; step 1: import
     (icalendar-import-buffer temp-diary t t)
+
+    ;; step 2: export what was just imported
     (save-excursion
       (find-file temp-diary)
       (icalendar-export-region (point-min) (point-max) temp-ics))
+
+    ;; compare the output of step 2 with the input of step 1
     (save-excursion
       (find-file temp-ics)
       (goto-char (point-min))
@@ -468,6 +517,8 @@
         (unless (string-equal org-input cycled)
           (error "Import test failed! Found `%s'\nbut expected `%s'" cycled
                  org-input))))
+
+    ;; clean up -- Note this is done only if test is passed
     (kill-buffer (find-buffer-visiting temp-diary))
     (save-excursion
       (set-buffer (find-buffer-visiting temp-ics))
@@ -1426,7 +1477,7 @@
  Class: PRIVATE 
 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
  Status: TENTATIVE
- Class: PRIVATE "
+ Class: PRIVATE"
    "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
  Status: TENTATIVE
  Class: PRIVATE 
@@ -1445,7 +1496,7 @@
  Class: PRIVATE 
 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
  Status: TENTATIVE
- Class: PRIVATE ")
+ Class: PRIVATE")
 
   ;; 2004-09-09 pg
   (icalendar-testsuite--test-export
@@ -1555,13 +1606,12 @@
 ORGANIZER:ulf
 ")
 
-  ;; FIXME: does not work
-  ;;  (icalendar-testsuite--test-cycle
-  ;;   "DTSTART;VALUE=DATE:19190909
-  ;;DTEND;VALUE=DATE:19190910
-  ;;RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
-  ;;SUMMARY:and diary-anniversary
-  ;;")
+    (icalendar-testsuite--test-cycle
+     "DTSTART;VALUE=DATE:19190909
+DTEND;VALUE=DATE:19190910
+RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
+SUMMARY:and diary-anniversary
+")
   )
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]