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: Sat, 23 Oct 2004 12:18:30 -0400

Index: emacs/lisp/calendar/icalendar.el
diff -c emacs/lisp/calendar/icalendar.el:1.3 
emacs/lisp/calendar/icalendar.el:1.4
*** emacs/lisp/calendar/icalendar.el:1.3        Tue Oct 19 09:53:50 2004
--- emacs/lisp/calendar/icalendar.el    Sat Oct 23 16:13:06 2004
***************
*** 39,44 ****
--- 39,46 ----
  ;;        Added icalendar-export-region.
  ;;        The import and export commands do not clear their target file,
  ;;        but append their results to the target file.
+ ;;        I18n-problems fixed -- use calendar-(month|day)-name-array.
+ ;;        Fixed problems with export of multi-line diary entries.
  
  ;;  0.06: Bugfixes regarding icalendar-import-format-*.
  ;;        Fix in icalendar-convert-diary-to-ical -- thanks to Philipp
***************
*** 167,197 ****
  ;; NO USER SERVICABLE PARTS BELOW THIS LINE
  ;; ======================================================================
  
! (defconst icalendar-weekdayabbrev-table
!   '(("mon\\(day\\)?"    . "MO")
!     ("tue\\(sday\\)?"   . "TU")
!     ("wed\\(nesday\\)?" . "WE")
!     ("thu\\(rsday\\)?"  . "TH")
!     ("fri\\(day\\)?"    . "FR")
!     ("sat\\(urday\\)?"  . "SA")
!     ("sun\\(day\\)?"    . "SU"))
!   "Translation table for weekdays.")
! 
! (defconst icalendar-monthnumber-table
!   '(("^jan\\(uar\\)?y?$"       . 1)
!     ("^feb\\(ruar\\)?y?$"      . 2)
!     ("^mar\\(ch\\)?\\|märz$"   . 3)
!     ("^apr\\(il\\)?$"          . 4)
!     ("^ma[iy]$"                . 5)
!     ("^jun[ie]?$"              . 6)
!     ("^jul[iy]?$"              . 7)
!     ("^aug\\(ust\\)?$"         . 8)
!     ("^sep\\(tember\\)?$"      . 9)
!     ("^o[ck]t\\(ober\\)?$"     . 10)
!     ("^nov\\(ember\\)?$"       . 11)
!     ("^de[cz]\\(ember\\)?$"    . 12))
!   "Regular expressions for month names.
! Currently this matches only German and English.")
  
  (defvar icalendar-debug nil ".")
  
--- 169,175 ----
  ;; NO USER SERVICABLE PARTS BELOW THIS LINE
  ;; ======================================================================
  
! (defconst icalendar--weekday-array ["SU" "MO" "TU" "WE" "TH" "FR" "SA"])
  
  (defvar icalendar-debug nil ".")
  
***************
*** 511,528 ****
  
  (defun icalendar--get-month-number (monthname)
    "Return the month number for the given MONTHNAME."
!   (save-match-data
!     (let ((case-fold-search t))
!       (assoc-default monthname icalendar-monthnumber-table
!                      'string-match))))
  
  (defun icalendar--get-weekday-abbrev (weekday)
    "Return the abbreviated WEEKDAY."
!   ;;FIXME: ISO-like(?).
!   (save-match-data
!     (let ((case-fold-search t))
!       (assoc-default weekday icalendar-weekdayabbrev-table
!                      'string-match))))
  
  (defun icalendar--datestring-to-isodate (datestring &optional day-shift)
    "Convert diary-style DATESTRING to iso-style date.
--- 489,535 ----
  
  (defun icalendar--get-month-number (monthname)
    "Return the month number for the given MONTHNAME."
!   (catch 'found
!     (let ((num 1)
!           (m (downcase monthname)))
!       (mapc (lambda (month)
!               (let ((mm (downcase month)))
!                 (if (or (string-equal mm m)
!                         (string-equal (substring mm 0 3) m))
!                     (throw 'found num))
!                 (setq num (1+ num))))
!             calendar-month-name-array))
!     ;; Error:
!     -1))
! 
! (defun icalendar--get-weekday-number (abbrevweekday)
!   "Return the number for the ABBREVWEEKDAY."
!   (catch 'found
!     (let ((num 0)
!           (aw (downcase abbrevweekday)))
!       (mapc (lambda (day)
!               (let ((d (downcase day)))
!                 (if (string-equal d aw)
!                     (throw 'found num))
!                 (setq num (1+ num))))
!             icalendar--weekday-array))
!     ;; Error:
!     -1))
  
  (defun icalendar--get-weekday-abbrev (weekday)
    "Return the abbreviated WEEKDAY."
!   (catch 'found
!     (let ((num 0)
!           (w (downcase weekday)))
!       (mapc (lambda (day)
!               (let ((d (downcase day)))
!                 (if (or (string-equal d w)
!                         (string-equal (substring d 0 3) w))
!                     (throw 'found (aref icalendar--weekday-array num)))
!                 (setq num (1+ num))))
!             calendar-day-name-array))
!     ;; Error:
!     "??"))
  
  (defun icalendar--datestring-to-isodate (datestring &optional day-shift)
    "Convert diary-style DATESTRING to iso-style date.
***************
*** 648,654 ****
      (save-excursion
        (goto-char min)
        (while (re-search-forward
!               "^\\([^ \t\n].*\\)\\(\n[ \t].*\\)*" max t)
          (setq entry-main (match-string 1))
          (if (match-beginning 2)
              (setq entry-rest (match-string 2))
--- 655,661 ----
      (save-excursion
        (goto-char min)
        (while (re-search-forward
!               "^\\([^ \t\n].*\\)\\(\\(\n[ \t].*\\)*\\)" max t)
          (setq entry-main (match-string 1))
          (if (match-beginning 2)
              (setq entry-rest (match-string 2))
***************
*** 1171,1183 ****
                           ;; weekly and not all-day
                           (let* ((byday (cadr (assoc 'BYDAY rrule-props)))
                                  (weekday
!                                  (cdr (rassoc
!                                        byday
!                                        icalendar-weekdayabbrev-table))))
                             (icalendar--dmsg "weekly not-all-day")
!                            (if weekday
                                 (setq diary-string
!                                      (format "%s %s%s%s" weekday
                                               start-t (if end-t "-" "")
                                               (or end-t "")))
                               ;; FIXME!!!!
--- 1178,1190 ----
                           ;; weekly and not all-day
                           (let* ((byday (cadr (assoc 'BYDAY rrule-props)))
                                  (weekday
!                                  (icalendar--get-weekday-number byday)))
                             (icalendar--dmsg "weekly not-all-day")
!                            (if (> weekday -1)
                                 (setq diary-string
!                                      (format "%s %s%s%s"
!                                              (aref calendar-day-name-array
!                                                  weekday)
                                               start-t (if end-t "-" "")
                                               (or end-t "")))
                               ;; FIXME!!!!




reply via email to

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