aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/init/ycp-time.el
blob: f98a9cd6cd4dc0c06405d7b10f554418d37f125a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
;;; ycp-time.el -- My config for time related -*- lexical-binding: t -*-

;; Copyright (C) 2023 Free Software Foundation.

;; Author: Yuchen Pei <id@ypei.org>
;; Package-Requires: ((emacs "28.2"))

;; This file is part of dotfiles.

;; dotfiles is free software: you can redistribute it and/or modify it under
;; the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; dotfiles is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General
;; Public License for more details.

;; You should have received a copy of the GNU Affero General Public
;; License along with dotfiles.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; My config for time related. Covers date, time, calendar, holidays etc.

;;; Code:



(my-configure
  (my-setq-from-local calendar-latitude calendar-longitude calendar-location-name)
  (setq calendar-mark-holidays-flag t)

;;;;; World clock (M-x world-clock)
  (setq display-time-world-list t)
  (setq zoneinfo-style-world-list ; timedatectl list-timezones
        '(("Pacific/Honolulu" "Honolulu")
          ("America/Los_Angeles" "Los Angeles")
          ("America/Chicago" "Chicago")
          ("America/New_York" "Boston")
          ("UTC" "UTC")
          ("Europe/London" "Coventry")
          ("Europe/Berlin" "Berlin")
          ("Africa/Khartoum" "Khartoum")
          ("Europe/Helsinki" "Helsinki")
          ("Asia/Dubai" "Dubai")
          ("Asia/Yekaterinburg" "Yekaterinburg")
          ("Asia/Calcutta" "Delhi")
          ("Asia/Shanghai" "Shanghai")
          ("Pacific/Auckland" "Auckland")))

  ;; All of the following variables are for Emacs 28
  (require 'time)
  (setq world-clock-list t)
  (setq world-clock-time-format "%R %z  %A %d %B")
  (setq world-clock-buffer-name "*world-clock*") ; Placement handled by `display-buffer-alist'
  (setq world-clock-timer-enable t)
  (setq world-clock-timer-second 60)

  ;; Holidays
  (setq holiday-other-holidays
        '(
	        (holiday-float 4 1 3 "Sechseläuten (Burning of Böögg)")
	        (holiday-fixed 3 8 "Women's Day")
          (holiday-chinese 4 8 "Buddha's birthday (East Asia)")
	        (holiday-fixed 4 26 "World Intellectual Pooperty Day")
	        (holiday-fixed 4 30 "Walpurgis Night")
	        (holiday-fixed 5 1  "May Day")
	        (holiday-fixed 5 12 "International Nurses Day")
	        (holiday-fixed 6 4 "International Nothing Happened On This Day")
	        (holiday-float 6 6 1 "Midsommar" 20)
	        (holiday-float 9 6 3 "Software Freedom Day")
	        (holiday-islamic 10 1 "Hari Raya Puasa")
	        (holiday-fixed 12 13 "St Lucia Day")
          (holiday-easter-etc -47 "Fat Tuesday / Fettisdagen / Pancake Tuesday / Mardi Gras")
          (holiday-easter-etc 39 "Ascension Day")
          (holiday-easter-etc 60 "Corpus Christi")
	        )
        calendar-chinese-all-holidays-flag t
        holiday-local-holidays
        '(
	        (holiday-fixed 1 26 "Australia Day (Vic holiday)")
	        (holiday-float 3 1 2 "Labour Day (Vic holiday)")
	        (holiday-fixed 4 25 "Anzac Day (Vic holiday)")
	        (holiday-float 6 1 2 "Monarch's Birthday (Vic oliday)")
	        (holiday-fixed 6 30 "End of financial year")
	        (holiday-float 9 5 -1 "(Possibly) Friday before the AFL Grand Final (Vic holiday)")
	        (holiday-float 10 5 1 "(Possibly) Friday before the AFL Grand Final (Vic holiday)")
	        (holiday-float 11 2 1 "Melbourne Cup (Vic holiday)")
	        )
        holiday-general-holidays
        '(
	        (holiday-fixed 1 1 "New Year's Day")
	        (holiday-fixed 2 14 "Valentine's Day")
	        (holiday-fixed 3 17 "St. Patrick's Day")
	        (holiday-fixed 4 1 "April Fools' Day")
	        (holiday-float 5 0 2 "Mother's Day")
	        (holiday-float 6 0 3 "Father's Day")
	        (holiday-fixed 7 4 "US Independence Day")
	        (holiday-fixed 10 31 "Halloween")
	        (holiday-float 11 4 4 "Thanksgiving")
	        )
        holiday-bahai-holidays
        '()
        holiday-hebrew-holidays
        '()
        )
  (setq calendar-holidays
        (append holiday-general-holidays holiday-local-holidays
                holiday-other-holidays holiday-christian-holidays
                holiday-hebrew-holidays holiday-islamic-holidays
                holiday-bahai-holidays holiday-oriental-holidays
                holiday-solar-holidays
                (my-get-from-local my-holiday-personal-holidays)))
  (put 'list-timers 'disabled nil)
  )

(my-package appt
  (:delay 20)
  (setq appt-message-warning-time 5)
  (setq appt-display-duration 30)
  (setq appt-display-interval 5)
  ;; dbus notification of appt
  (require 'my-time)
  (setq appt-disp-window-function #'my-app-display-window)
  ;; with org-agenda-to-appt
  (require 'org-clock)
  (require 'my-utils)
  (when (boundp 'appt-to-agenda-timer)
    (cancel-timer appt-to-agenda-timer))
  (when (my-server-p)
    (setq appt-to-agenda-timer
	        (run-at-time
	         "07:00am"
	         86400 #'org-agenda-to-appt))))

(provide 'ycp-time)
;;; ycp-time.el ends here