-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkitchingroup.el
64 lines (45 loc) · 1.97 KB
/
kitchingroup.el
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
;;; kitchingroup.el --- Kitchingroup utility functions
;;; Commentary:
;;
(defun kitchingroup-weekly-report (&optional arg)
"Create/open this week's progress report.
With a prefix arg, specify the week to open.
This function will create a folder called reports/year-mm-dd and put a weekly-report template inside it, or open the one that exists.
The week beginning is defined by `calendar-week-start-day'. The
report is for the previous week."
(interactive "P")
(let* ((date (if arg (org-read-date) (format-time-string "%Y-%m-%d")))
(f (split-string date "-"))
(year (string-to-number (nth 0 f)))
(month (string-to-number (nth 1 f)))
(day (string-to-number (nth 2 f)))
(day-name (calendar-day-name (list month day year)))
;; this is the day number within a week.
(day-number (loop for i from 0
if (string= day-name (aref calendar-day-name-array i))
return i))
(week-beginning
(if (= day-number calendar-week-start-day)
day
(- day (- day-number calendar-week-start-day))))
(dir (format "reports/%s-%s-%s/" year month week-beginning)))
(unless (file-directory-p (expand-file-name dir))
(make-directory dir t))
(let ((default-directory (expand-file-name dir)))
(ox-manuscript-new-helm "weekly-progress-report"))))
(defalias 'kitchinhub-weekly-report 'kitchingroup-weekly-report)
(defun kitchingroup-calendar ()
"Open the Kitchin Group Google calendar."
(interactive)
(browse-url "https://calendar.google.com/calendar?cid=NXE3aHRwMDZxazk3djltcHBzdHVwdmpkczRAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ"))
(defun kitchingroup-mail-archives ()
"Open the Kitchin group email archive in a browser."
(interactive)
(browse-url "https://lists.andrew.cmu.edu/mailman/private/kitchin-group/"))
(defun kitchingroup-send-mail ()
"Send an email to the Kitchin group email list."
(interactive)
(compose-mail "[email protected]")
(message-goto-subject))
(provide 'kitchingroup)
;;; kitchingroup.el ends here