mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
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.
This commit is contained in:
parent
d8a1a56f5b
commit
f8e1b18d37
2 changed files with 81 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1257,6 +1257,50 @@ UID:8814e3f9-7482-408f-996c-3bfe486a1263
|
|||
UID: 8814e3f9-7482-408f-996c-3bfe486a1263
|
||||
"))
|
||||
|
||||
(ert-deftest icalendar-import-bug-24199 ()
|
||||
;;bug#24199 -- monthly rule with byday-clause
|
||||
(icalendar-tests--test-import
|
||||
"
|
||||
SUMMARY:Summary
|
||||
DESCRIPTION:Desc
|
||||
LOCATION:Loc
|
||||
DTSTART:20151202T124600
|
||||
DTEND:20151202T160000
|
||||
RRULE:FREQ=MONTHLY;BYDAY=1WE;INTERVAL=1
|
||||
EXDATE:20160106T114600Z
|
||||
EXDATE:20160203T114600Z
|
||||
EXDATE:20160302T114600Z
|
||||
EXDATE:20160504T104600Z
|
||||
EXDATE:20160601T104600Z
|
||||
CLASS:DEFAULT
|
||||
TRANSP:OPAQUE
|
||||
BEGIN:VALARM
|
||||
ACTION:DISPLAY
|
||||
TRIGGER;VALUE=DURATION:-PT3H
|
||||
END:VALARM
|
||||
LAST-MODIFIED:20160805T191040Z
|
||||
UID:9188710a-08a7-4061-bae3-d4cf4972599a
|
||||
"
|
||||
"&%%(and (not (diary-date 2016 1 6)) (not (diary-date 2016 2 3)) (not (diary-date 2016 3 2)) (not (diary-date 2016 5 4)) (not (diary-date 2016 6 1)) (diary-float t 3 1) (diary-block 2015 12 2 9999 1 1)) 12:46-16:00 Summary
|
||||
Desc: Desc
|
||||
Location: Loc
|
||||
Class: DEFAULT
|
||||
UID: 9188710a-08a7-4061-bae3-d4cf4972599a
|
||||
"
|
||||
"&%%(and (not (diary-date 6 1 2016)) (not (diary-date 3 2 2016)) (not (diary-date 2 3 2016)) (not (diary-date 4 5 2016)) (not (diary-date 1 6 2016)) (diary-float t 3 1) (diary-block 2 12 2015 1 1 9999)) 12:46-16:00 Summary
|
||||
Desc: Desc
|
||||
Location: Loc
|
||||
Class: DEFAULT
|
||||
UID: 9188710a-08a7-4061-bae3-d4cf4972599a
|
||||
"
|
||||
"&%%(and (not (diary-date 1 6 2016)) (not (diary-date 2 3 2016)) (not (diary-date 3 2 2016)) (not (diary-date 5 4 2016)) (not (diary-date 6 1 2016)) (diary-float t 3 1) (diary-block 12 2 2015 1 1 9999)) 12:46-16:00 Summary
|
||||
Desc: Desc
|
||||
Location: Loc
|
||||
Class: DEFAULT
|
||||
UID: 9188710a-08a7-4061-bae3-d4cf4972599a
|
||||
"
|
||||
))
|
||||
|
||||
(ert-deftest icalendar-import-multiple-vcalendars ()
|
||||
(icalendar-tests--test-import
|
||||
"DTSTART;VALUE=DATE:20110723
|
||||
|
|
|
|||
Loading…
Reference in a new issue