diff options
author | Ulf Jasper <ulf.jasper@web.de> | 2016-11-23 18:09:34 +0100 |
---|---|---|
committer | Ulf Jasper <ulf.jasper@web.de> | 2016-11-23 18:09:34 +0100 |
commit | f8e1b18d37e46f320ba0bd81efbbcf557c1f64d7 (patch) | |
tree | deb04c35c64c93b7f19879c993fdeb5786a1a5db /lisp/calendar/icalendar.el | |
parent | d8a1a56f5bce64d6ea6ccecdf1aaa4eb3a9898da (diff) | |
download | emacs-f8e1b18d37e46f320ba0bd81efbbcf557c1f64d7.tar.gz |
Fix Bug#24199.
* lisp/calendar/icalendar.el (icalendar--do-create-ical-alarm): Quote
bracket in doc string (make checkdoc happy).
(icalendar-import-buffer),
(icalendar-import-buffer),
(icalendar--convert-ical-to-diary),
(icalendar--add-diary-entry): Rename argument diary-file to
diary-filename (make checkdoc happy).
(icalendar--convert-recurring-to-diary): Take care of byday-clause
in monthly recurring events. Actually fix Bug#24199.
* test/lisp/calendar/icalendar-tests.el (icalendar-import-bug-24199): New.
Diffstat (limited to 'lisp/calendar/icalendar.el')
-rw-r--r-- | lisp/calendar/icalendar.el | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index e7ad7383456..2f557f547af 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -2389,22 +2389,43 @@ END-T is the event's end time in diary format." ;; monthly ((string-equal frequency "MONTHLY") (icalendar--dmsg "monthly") - (setq result - (format - "%%%%(and (diary-date %s) (diary-block %s %s)) %s%s%s" - (let ((day (nth 3 dtstart-dec))) - (cond ((eq calendar-date-style 'iso) - (format "t t %d" day)) - ((eq calendar-date-style 'european) - (format "%d t t" day)) - ((eq calendar-date-style 'american) - (format "t %d t" day)))) - dtstart-conv - (if until - until-conv - (if (eq calendar-date-style 'iso) "9999 1 1" "1 1 9999")) ;; FIXME: should be unlimited - (or start-t "") - (if end-t "-" "") (or end-t "")))) + (let* ((byday (cadr (assoc 'BYDAY rrule-props))) + (count-weekday + (and byday + (save-match-data + (when (string-match "\\(-?[0-9]+\\)\\([A-Z][A-Z]\\)" + byday) + (cons (substring byday + (match-beginning 1) + (match-end 1)) + (substring byday + (match-beginning 2) + (match-end 2))))))) + (rule-part + (if count-weekday + (let ((count (car count-weekday)) + (weekdaynum (icalendar--get-weekday-number + (cdr count-weekday)))) + ;; FIXME: this is valid only for interval==1 + (format "(diary-float t %s %s)" weekdaynum count)) + (format "(diary-date %s)" + (let ((day (nth 3 dtstart-dec))) + (cond ((eq calendar-date-style 'iso) + (format "t t %d" day)) + ((eq calendar-date-style 'european) + (format "%d t t" day)) + ((eq calendar-date-style 'american) + (format "t %d t" day)))))))) + (setq result + (format + "%%%%(and %s (diary-block %s %s)) %s%s%s" + rule-part + dtstart-conv + (if until + until-conv + (if (eq calendar-date-style 'iso) "9999 1 1" "1 1 9999")) ;; FIXME: should be unlimited + (or start-t "") + (if end-t "-" "") (or end-t ""))))) ;; daily ((and (string-equal frequency "DAILY")) (if until |