bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#34315: [PATCH] icalendar.el: DURATION fix + more robust timezone han


From: Thomas Plass
Subject: bug#34315: [PATCH] icalendar.el: DURATION fix + more robust timezone handling
Date: Thu, 1 Oct 2020 21:53:55 +0300

Cleaned up version:

(defun icalendar-tests--get-ical-from-file (ics-file &optional component)
  "Return iCalendar data structures from ICS-FILE.
Optional symbol COMPONENT names a top-level component like 'VTIMEZONE."
  (let (ical)
    (if (file-exists-p ics-file)
        (save-excursion
          (with-temp-buffer
            (insert-file-contents ics-file)
            (goto-char (point-min))
            (setq ical (car (icalendar--read-element nil nil)))
            (if component
                (car (icalendar--get-children ical component))
              ical)))
      (error "Can't find ICS file %s" ics-file))))



Thomas Plass wrote at 21:49 on October 1, 2020:
: 
:   - extend icalendar-tests.el with the following:
: 
:     (defvar icalendar-resources-directory "icalendar-resources"
:       "Name of directory containing ICS files.
:     This directory is relative to icalendar-tests.el.")
:     
:     (defun icalendar-tests--get-ical-from-file (ics-file &optional component)
:       "Return iCalendar data structures from ICS-FILE.
:     Optional symbol COMPONENT names a top-level component like 'VTIMEZONE."
:       (let (ical)
:         (if (file-exists-p ics-file)
:             (save-excursion
:               (with-temp-buffer
:                 (insert-file-contents ics-file)
:                 (goto-char (point-min))
:                 (setq ical (car (icalendar--read-element nil nil)))
:                 (if component
:                     (setq res (car (icalendar--get-children ical component)))
:                   (setq res ical))))
:           (error "Can't find ICS file %s" ics-file))))





reply via email to

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