emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/calendar/icalendar.el
Date: Thu, 24 Feb 2005 13:22:29 -0500

Index: emacs/lisp/calendar/icalendar.el
diff -c emacs/lisp/calendar/icalendar.el:1.6 
emacs/lisp/calendar/icalendar.el:1.7
*** emacs/lisp/calendar/icalendar.el:1.6        Fri Feb 11 01:02:56 2005
--- emacs/lisp/calendar/icalendar.el    Thu Feb 24 18:22:28 2005
***************
*** 90,96 ****
  
  ;;; Code:
  
! (defconst icalendar-version 0.09
    "Version number of icalendar.el.")
  
  ;; ======================================================================
--- 90,96 ----
  
  ;;; Code:
  
! (defconst icalendar-version 0.10
    "Version number of icalendar.el.")
  
  ;; ======================================================================
***************
*** 360,371 ****
                  (append result (list (list param-name param-value)))))))
      result))
  
! (defun icalendar--decode-isodatetime (isodatetimestring)
    "Return ISODATETIMESTRING in format like `decode-time'.
! Converts from ISO-8601 to Emacs representation.  If ISODATETIMESTRING
! specifies UTC time (trailing letter Z) the decoded time is given in
! the local time zone! FIXME: TZID-attributes are ignored....! FIXME:
! multiple comma-separated values should be allowed!"
    (icalendar--dmsg isodatetimestring)
    (if isodatetimestring
        ;; day/month/year must be present
--- 360,375 ----
                  (append result (list (list param-name param-value)))))))
      result))
  
! (defun icalendar--decode-isodatetime (isodatetimestring &optional day-shift)
    "Return ISODATETIMESTRING in format like `decode-time'.
! Converts from ISO-8601 to Emacs representation.  If
! ISODATETIMESTRING specifies UTC time (trailing letter Z) the
! decoded time is given in the local time zone!  If optional
! parameter DAY-SHIFT is non-nil the result is shifted by DAY-SHIFT
! days.
! 
! FIXME: TZID-attributes are ignored....!
! FIXME: multiple comma-separated values should be allowed!"
    (icalendar--dmsg isodatetimestring)
    (if isodatetimestring
        ;; day/month/year must be present
***************
*** 387,392 ****
--- 391,405 ----
                     (char-equal ?Z (aref isodatetimestring 15)))
            ;; if not UTC add current-time-zone offset
            (setq second (+ (car (current-time-zone)) second)))
+         ;; shift if necessary
+         (if day-shift
+             (let ((mdy (calendar-gregorian-from-absolute
+                         (+ (calendar-absolute-from-gregorian
+                             (list month day year))
+                            day-shift))))
+               (setq month (nth 0 mdy))
+               (setq day   (nth 1 mdy))
+               (setq year  (nth 2 mdy))))
          ;; create the decoded date-time
          ;; FIXME!?!
          (condition-case nil
***************
*** 1083,1089 ****
  
        ;; we're done, insert everything into the file
        (save-current-buffer
!         (let ((coding-system-for-write 'utf8))
            (set-buffer (find-file ical-filename))
            (goto-char (point-max))
            (insert "BEGIN:VCALENDAR")
--- 1096,1102 ----
  
        ;; we're done, insert everything into the file
        (save-current-buffer
!         (let ((coding-system-for-write 'utf-8))
            (set-buffer (find-file ical-filename))
            (goto-char (point-max))
            (insert "BEGIN:VCALENDAR")
***************
*** 1284,1290 ****
                                         (unt
                                          (icalendar--datetime-to-diary-date
                                           (icalendar--decode-isodatetime
!                                           until))))
                               (setq diary-string
                                     (format
                                      (concat "%%%%(and "
--- 1297,1303 ----
                                         (unt
                                          (icalendar--datetime-to-diary-date
                                           (icalendar--decode-isodatetime
!                                           until -1))))
                               (setq diary-string
                                     (format
                                      (concat "%%%%(and "
***************
*** 1297,1303 ****
                                       dtstart)
                                      (icalendar--datetime-to-diary-date
                                       (icalendar--decode-isodatetime
!                                       until)))))
                                 (setq diary-string
                                       (format "%%%%(and (diary-cyclic %d %s))"
                                               (* interval 7)
--- 1310,1316 ----
                                       dtstart)
                                      (icalendar--datetime-to-diary-date
                                       (icalendar--decode-isodatetime
!                                       until -1)))))
                                 (setq diary-string
                                       (format "%%%%(and (diary-cyclic %d %s))"
                                               (* interval 7)
***************
*** 1369,1375 ****
                                      e 'DTSTART))))
                               (de (icalendar--datetime-to-diary-date
                                    (icalendar--decode-isodatetime
!                                    until))))
                           (setq diary-string
                                 (format
                                  "%%%%(and (diary-block %s %s))"
--- 1382,1388 ----
                                      e 'DTSTART))))
                               (de (icalendar--datetime-to-diary-date
                                    (icalendar--decode-isodatetime
!                                    until -1))))
                           (setq diary-string
                                 (format
                                  "%%%%(and (diary-block %s %s))"
***************
*** 1406,1416 ****
                                        (format "......"))))
                        (icalendar--split-value rdate)))
               ;; non-recurring event
!              ;; long event
               ((not (string= start-d end-d))
                (icalendar--dmsg "non-recurring event")
                (let ((ds (icalendar--datetime-to-diary-date dtstart))
!                     (de (icalendar--datetime-to-diary-date dtend)))
                  (setq diary-string
                        (format "%%%%(and (diary-block %s %s))"
                                ds de)))
--- 1419,1432 ----
                                        (format "......"))))
                        (icalendar--split-value rdate)))
               ;; non-recurring event
!              ;; all-day event
               ((not (string= start-d end-d))
                (icalendar--dmsg "non-recurring event")
                (let ((ds (icalendar--datetime-to-diary-date dtstart))
!                     (de (icalendar--datetime-to-diary-date
!                          (icalendar--decode-isodatetime
!                           (icalendar--get-event-property e 'DTEND)
!                           -1))))
                  (setq diary-string
                        (format "%%%%(and (diary-block %s %s))"
                                ds de)))




reply via email to

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