From 5d4cadf99d7eb789b64d04f863e15b04ec04cf0e Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Mon, 24 Apr 2023 19:04:50 +0100 Subject: Fix diary schedule function --- ymh-emacs/ymh-diary.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ymh-emacs/ymh-diary.el b/ymh-emacs/ymh-diary.el index 4bbef62..817eedb 100644 --- a/ymh-emacs/ymh-diary.el +++ b/ymh-emacs/ymh-diary.el @@ -10,11 +10,12 @@ ;;; Code: -(defun ymh-diary-schedule (y1 m1 d1 y2 m2 d2 dayname) +(defun ymh-diary-schedule (y1 m1 d1 y2 m2 d2 dayname &optional mark) "Entry applies if date is between dates on DAYNAME. Order of the parameters is M1, D1, Y1, M2, D2, Y2 if `european-calendar-style' is nil, and D1, M1, Y1, D2, M2, Y2 if `european-calendar-style' is t. Entry does not apply on a history." + (with-no-warnings (defvar date) (defvar entry)) (let ((date1 (calendar-absolute-from-gregorian (list m1 d1 y1))) (date2 (calendar-absolute-from-gregorian (list m2 d2 y2))) (d (calendar-absolute-from-gregorian date))) @@ -24,7 +25,7 @@ (= (calendar-day-of-week date) dayname) ;;(not (calendar-check-holidays date)) ) - entry))) + (cons mark entry)))) (defun ymh-diary-last-day-of-month (date) "Return `t` if DATE is the last day of the month." @@ -35,7 +36,7 @@ (calendar-last-day-of-month month year))) (= day last-day-of-month))) -(defun ymh-diary-export-to-ics () +(defun ymh-diary-org-export-to-ics () "Export diary file to ICal format." (with-temp-buffer (insert-file-contents diary-file) @@ -49,6 +50,13 @@ X-WR-CALNAME:Emacs X-Built-On-Cache-Miss:true " ics-file-body "END:VCALENDAR"))) +(defun ymh-diary-export-to-ics () + "Export the current diary to ICS format." + (interactive) + (icalendar-export-file + diary-file + (expand-file-name "emacs.ics" "~/Downloads"))) + (provide 'ymh-diary) ;;; ymh-diary.el ends here -- cgit