-NONMARKER is a regular expression matching the start of non-marking
-entries. ENTRY-MAIN is the first line of the diary entry."
- (if (string-match (concat nonmarker
- "%%(diary-float \\([^)]+\\))\\s-*\\(.*?\\) ?$")
- entry-main)
- (progn
- (icalendar--dmsg "diary-float %s" entry-main)
- (error "`diary-float' is not supported yet"))
+ NONMARKER is a regular expression matching the start of non-marking
+ entries. ENTRY-MAIN is the first line of the diary entry."
+ (if (string-match (concat nonmarker "%%\\((diary-float .+\\) ?$") entry-main)
+ (with-temp-buffer
+ (insert (match-string 1 entry-main))
+ (goto-char (point-min))
+ (let* ((sexp (read (current-buffer))) ;using `read' here
+ ;easier than regexp
+ ;matching, esp. with
+ ;different forms of
+ ;MONTH
+ (month (nth 1 sexp))
+ (dayname (nth 2 sexp))
+ (n (nth 3 sexp))
+ (day (nth 4 sexp))
+ (summary
+ (replace-regexp-in-string
+ "\\(^\s+\\|\s+$\\)" ""
+ (buffer-substring (point) (point-max)))))
+
+ (when day
+ (progn
+ (icalendar--dmsg "diary-float %s" entry-main)
+ (error "Don't know if or how to implement day in `diary-float'")))
+
+ (list (concat
+ ;;Start today (yes this is an arbitrary choice):
+ "\nDTSTART;VALUE=DATE:"
+ (format-time-string "%Y%m%d" (current-time))
+ ;;BUT remove today if `diary-float'
+ ;;expression does not hold true for today:
+ (when
+ (null (let ((date (calendar-current-date))
+ (entry entry-main))
+ (diary-float month dayname n)))
+ (concat
+ "\nEXDATE;VALUE=DATE:"
+ (format-time-string "%Y%m%d" (current-time))))
+ "\nRRULE:"
+ (if (or (numberp month) (listp month))
+ "FREQ=YEARLY;BYMONTH="
+ "FREQ=MONTHLY")
+ (when
+ (listp month)
+ (mapconcat
+ (lambda (m)
+ (number-to-string m))
+ (cadr month) ","))
+ (when
+ (numberp month)
+ (number-to-string month))
+ ";BYDAY="
+ (number-to-string n)
+ (aref icalendar--weekday-array dayname))
+ summary)))