diff options
author | Yann Herklotz <git@yannherklotz.com> | 2022-11-27 12:08:11 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2022-11-27 12:08:11 +0000 |
commit | ad161b70c317cc766c6ec42064cb6410136c7905 (patch) | |
tree | 56b914aabe00e6526e7ba1cdd5aeb9a3ab4da732 /ymh-emacs/ymh-diary.el | |
parent | 3cc9791003364c338cc6d219c5f144210aa76bef (diff) | |
download | ymh-emacs-ad161b70c317cc766c6ec42064cb6410136c7905.tar.gz ymh-emacs-ad161b70c317cc766c6ec42064cb6410136c7905.zip |
Take more configuration into packages
Diffstat (limited to 'ymh-emacs/ymh-diary.el')
-rw-r--r-- | ymh-emacs/ymh-diary.el | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ymh-emacs/ymh-diary.el b/ymh-emacs/ymh-diary.el index 9654971..343d331 100644 --- a/ymh-emacs/ymh-diary.el +++ b/ymh-emacs/ymh-diary.el @@ -1,5 +1,8 @@ ;;; ymh-diary.el --- Extensions to the Emacs Diary -*- lexical-binding: t; -*- +;; Author: Yann Herklotz <git@yannherklotz.com> +;; Package-Requires: ((emacs "24.3")) + ;;; Commentary: ;; This file contains extensions to the built-in Emacs Diary. Mainly, it adds a @@ -7,4 +10,31 @@ ;;; Code: +(defun ymh-diary-schedule (y1 m1 d1 y2 m2 d2 dayname) + "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." + (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))) + (if (and + (<= date1 d) + (<= d date2) + (= (calendar-day-of-week date) dayname) + ;;(not (calendar-check-holidays date)) + ) + entry))) + +(defun ymh-diary-last-day-of-month (date) + "Return `t` if DATE is the last day of the month." + (let* ((day (calendar-extract-day date)) + (month (calendar-extract-month date)) + (year (calendar-extract-year date)) + (last-day-of-month + (calendar-last-day-of-month month year))) + (= day last-day-of-month))) + +(provide 'ymh-diary) + ;;; ymh-diary.el ends here |