-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.el
212 lines (188 loc) · 7.25 KB
/
config.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
;;; private/my-org/config.el -*- lexical-binding: t; -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Package Definition
;;;
;;; - org-pomodoro
;;; - org-super-agendsa
;;; - ox-hugo
;;; - org-hugo-auto-export-mode
;;; - org-journal
;;; - org-attach-screenshot
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Org pomodoro
(def-package! org-pomodoro
:init (setq org-pomodoro-length '50
org-pomodoro-short-break-length '10)
:config
(defvar terminal-notifier-command
(executable-find "terminal-notifier") "/usr/local/bin/terminal-notifier")
;; Org notification
(defun notify-osx (title message)
(start-process "terminal-notifier"
"*terminal-notifier*"
terminal-notifier-command
"-title" title
"-message" message
"-sender" "org.gnu.Emacs"
"-activate" "org.gnu.Emacs"))
(add-hook 'org-pomodoro-finished-hook
(lambda ()
(notify-osx "Pomodoro completed!" "Time for a break.")))
(add-hook 'org-pomodoro-break-finished-hook
(lambda ()
(notify-osx "Pomodoro Short Break Finished" "Ready for Another?")))
(add-hook 'org-pomodoro-long-break-finished-hook
(lambda ()
(notify-osx "Pomodoro Long Break Finished" "Ready for Another?")))
(add-hook 'org-pomodoro-killed-hook
(lambda ()
(notify-osx "Pomodoro Killed" "One does not simply kill a pomodoro!")))
)
;; Org Super Agenda
(def-package! org-super-agenda
:config
(org-super-agenda-mode)
;;; Agenda filters
;; Inbox
(add-to-list 'org-agenda-custom-commands
'("i" "inbox"
((tags-todo "+CATEGORY=\"inbox\"" ((org-super-agenda-groups
'((:name "Inbox items"
:todo "TODO")
(:discard (:anything)))))))))
)
;; Hugo blog
(def-package! ox-hugo
:after ox
)
;; Org hugo auto export mode
(def-package! org-hugo-auto-export-mode)
;; Org journal
(def-package! org-journal
:custom
(org-journal-dir "~/Dropbox/X_GTD/journal/")
(org-journal-file-format "%Y-%m-%d.org")
)
;; Org attach screenshot
(def-package! org-attach-screenshot
:config
(setq org-attach-screenshot-command-line "screencapture -i %f")
)
;; org-mru-clock
(def-package! org-mru-clock
:init
(setq org-mru-clock-how-many 100
org-mru-clock-completing-read #'ivy-completing-read)
)
;; org-effectiveness
(def-package! org-effectiveness)
;; org-ql
(def-package! org-ql
:config
(setq org-ql-views
(list
(cons "Recent entries" #'org-ql-view-recent-items)
))
;; Most Importants Tasks
;; - Show priority A tasks in 7 days
(defun custom-ql-most-important-thins ()
(interactive)
(org-ql-search (org-agenda-files)
'(and (todo "TODO" "STARTED" "BLOCKED")
(priority >= "A")
(or (deadline auto)
(scheduled :to today)))
:title "Most Important Tasks"
:sort '(deadline priority)
:super-groups '((:name "Deadline"
:deadline past
:deadline today)
(:name "Scheduled"
:scheduled past
:deadline today))))
;; Work Related Tasks Scheduled or Deadline today
(defun custom-ql-work-related-tasks ()
(interactive)
(org-ql-search (org-agenda-files)
'(and (or (scheduled :to today)
(deadline :to today))
(todo "TODO" "STARTED" "BLOCKED")
(not (tags "PROJ"))
(category "iqiyi" "pingduck" "workflow" "talk" "blog" "open-source" "programming"))
:title "Work Related Tasks"
:sort '(priority deadline scheduled)
:super-groups '((:name "STARTED"
:todo "STARTED")
(:name "Deadline"
:deadline past
:deadline today)
(:name "Scheduled"
:scheduled past
:scheduled today)))
)
;; Non-Work Related Tasks Scheduled or Deadline today
(defun custom-ql-non-work-related-tasks ()
(interactive)
(org-ql-search (org-agenda-files)
'(and (or (scheduled :to today)
(deadline :to today))
(todo "TODO" "STARTED" "BLOCKED")
(not (tags "PROJ"))
(not (category "iqiyi" "pingduck" "workflow" "talk" "blog" "open-source" "programming")))
:title "Non-Work Related Tasks"
:sort '(priority deadline scheduled)
:super-groups '((:name "STARTED"
:todo "STARTED")
(:name "Deadline"
:deadline past
:deadline today)
(:name "Scheduled"
:scheduled past
:scheduled today))))
;; Weekly Review
(defun custom-ql-weekly-review ()
(interactive)
(let* ((ts-default-format "%Y-%m-%d")
(beg (ts-format (car (current-week-range))))
(end (ts-format (cdr (current-week-range)))))
(org-ql-search (org-agenda-files)
`(and (todo "TODO" "STARTED" "BLOCKED" "DONE")
(tags "PROJ")
(or (deadline :from ,beg :to ,end)
(closed :from ,beg :to ,end)))
:title "Weekly Review"
:super-groups '((:name "STARTED"
:todo "STARTED")
(:name "TODO"
:todo "TODO")
(:name "BLOCKED"
:todo "BLOCKED")
(:name "DONE"
:todo "DONE"))
)))
)
(defun current-week-range ()
"Return timestamps (BEG . END) spanning current calendar week."
(let* (;; Bind `now' to the current timestamp to ensure all calculations
;; begin from the same timestamp. (In the unlikely event that
;; the execution of this code spanned from one day into the next,
;; that would cause a wrong result.)
(now (ts-now))
;; We start by calculating the offsets for the beginning and
;; ending timestamps using the current day of the week. Note
;; that the `ts-dow' slot uses the "%w" format specifier, which
;; counts from Sunday to Saturday as a number from 0 to 6.
(adjust-beg-day (- 1 (ts-dow now)))
(adjust-end-day (- 7 (ts-dow now)))
;; Make beginning/end timestamps based on `now', with adjusted
;; day and hour/minute/second values. These functions return
;; new timestamps, so `now' is unchanged.
(beg (thread-last now
;; `ts-adjust' makes relative adjustments to timestamps.
(ts-adjust 'day adjust-beg-day)
;; `ts-apply' applies absolute values to timestamps.
(ts-apply :hour 0 :minute 0 :second 0)))
(end (thread-last now
(ts-adjust 'day adjust-end-day)
(ts-apply :hour 23 :minute 59 :second 59))))
(cons beg end)))