blob: 5c15ef6dad0715ccbe688f79bf5888ee7ebfe156 (
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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
(require 'fcuny-vars)
(use-package dash
:ensure t)
(use-package org
:after (dash)
:ensure t
:hook ((org-mode . visual-line-mode)
(org-mode . org-indent-mode)
(org-capture-mode-hook . delete-other-windows))
:bind (("C-c c" . org-capture)
("C-c a" . org-agenda)
("C-c o" . hydra-org-menu/body))
:config
(progn ()
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)
(python . t)
(emacs-lisp . t))))
(defhydra hydra-org-menu (:hint nil)
"
^go to ^ ^action ^
^-------------------^ ^---------------^
_g i_: go to inbox _s_: save files
_g p_: go to personal
_g w_: go to work
_g n_: go to notes
"
("g i" (find-file-other-window org-default-inbox-file))
("g p" (find-file-other-window org-default-personal-file))
("g w" (find-file-other-window org-default-work-file))
("g n" (find-file-other-windw org-default-notes-file))
("s" (org-save-all-org-buffers)))
:custom
;; cosmetic
(org-pretty-entities t)
(org-startup-indented nil)
(org-tags-column -97)
;;
(org-log-done 'time)
;; priorities
(org-priority-start-cycle-with-default nil) ;; Start one over/under default value.
(org-lowest-priority ?D)
(org-default-priority ?D) ;; Ensures unset tasks have low priority.
(org-priority-faces '((?A . "#ff2600")
(?B . "#ff5900")
(?C . "#ff9200")
(?D . "#747474")))
;; files
(org-directory (expand-file-name "~/Documents/notebooks"))
(org-archive-dir (concat org-directory "/archive/"))
(org-default-personal-file (concat org-directory "/personal.org"))
(org-default-work-file (concat org-directory "/twitter.org"))
(org-default-journal-file (concat org-directory "/journal.org"))
(org-default-inbox-file (concat org-directory "/inbox.org"))
(org-default-notes-file (concat org-directory "/notes.org"))
;; how to manage tasks
(org-todo-keywords '((sequence "TODO(t)" "STARTED(s)" "DELEGATED(D)" "|" "DONE(d)")
(sequence "|" "MEETING(m)" "NOTE(n)")
(sequence "PROJECT" "|" "PROJECTDONE")
(sequence "SOMEDAY" "|" "CANCELED(c)")))
;; agenda related
(org-agenda-start-on-weekday 1)
(org-agenda-files `(,org-default-personal-file
,org-default-work-file))
(org-agenda-custom-commands
(quote
(("w" . "Work...")
("wt" "Work Today"
((tags-todo "DEADLINE=\"<+0d>\""
((org-agenda-overriding-header "Due today")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'notdeadline))
(org-agenda-sorting-strategy '(priority-down))))
(tags-todo "DEADLINE<\"<+0d>\""
((org-agenda-overriding-header "Overdue")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'notdeadline))
(org-agenda-sorting-strategy '(priority-down))))
(tags-todo "TODO={STARTED}"
((org-agenda-overriding-header "Started")
(org-agenda-sorting-strategy '(priority-down))))
(tags "TODO={MEETING}+CREATED>\"<-7d>\""
((org-agenda-overriding-header "Recent meetings (last 7 days)")))
(tags "TODO={NOTE}+CREATED>\"<-7d>\""
((org-agenda-overriding-header "Recent notes (last 7 days)")))
(agenda ""
((org-agenda-entry-types '(:scheduled))
(org-agenda-overriding-header "Scheduled")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'todo 'done))
(org-agenda-sorting-strategy
'(priority-down time-down))
(org-agenda-span 'day)
(org-agenda-start-on-weekday nil)
(org-agenda-time-grid nil))))
((org-agenda-files `(,org-default-work-file))
(org-agenda-sorting-strategy '(deadline-up))))
("wp" "For 1:1"
((tags "people&TODO={TODO\\|STARTED}"
((org-agenda-overriding-header "Tasks for 1:1")))))
("p" . "Personal ...")
("pt" "Personal Today"
((tags-todo "DEADLINE=\"<+0d>\""
((org-agenda-overriding-header "Due today")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'notdeadline))
(org-agenda-sorting-strategy '(priority-down))))
(tags-todo "DEADLINE<\"<+0d>\""
((org-agenda-overriding-header "Overdue")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'notdeadline))
(org-agenda-sorting-strategy '(priority-down))))
(tags-todo "TODO={STARTED}"
((org-agenda-overriding-header "Started")
(org-agenda-sorting-strategy '(priority-down))))
(tags "TODO={NOTE}+CREATED>\"<-7d>\""
((org-agenda-overriding-header "Recent notes (last 7 days)")))
(agenda ""
((org-agenda-entry-types '(:scheduled))
(org-agenda-overriding-header "Scheduled")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'todo 'done))
(org-agenda-sorting-strategy
'(priority-down time-down))
(org-agenda-span 'day)
(org-agenda-start-on-weekday nil)
(org-agenda-time-grid nil))))
((org-agenda-files `(,org-default-personal-file
,org-default-notes-file))
(org-agenda-sorting-strategy '(deadline-up))))
("r" . "Review ...")
("rt" "Triage (unscheduled tasks)"
((tags "TODO<>\"\"&TODO<>{DONE\\|CANCELED\\|NOTE\\|MEETING\\|PROJECT}"
((org-agenda-overriding-header "Unscheduled tasks: ")
(org-agenda-skip-function
(quote
(org-agenda-skip-entry-if
(quote scheduled)
(quote deadline)
(quote timestamp)
(quote regexp)
"\\* \\(SOMEDAY\\)")))
(org-agenda-sorting-strategy
(quote
(category-up)))
(org-agenda-prefix-format "%-11c%5(org-todo-age) ")))))
("rs" "Someday tasks"
((tags-todo "TODO={SOMEDAY}"
((org-agenda-overriding-header "NO DUE DATE / SOMEDAY")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'deadline))))))
("h" "Hotlist (what's important and due soon)"
((tags-todo "DEADLINE<\"<+0d>\""
((org-agenda-overriding-header "OVERDUE")))
(tags-todo "DEADLINE>=\"<+0d>\"+DEADLINE<=\"<+1w>\""
((org-agenda-overriding-header "DUE IN NEXT 7 DAYS")))
(tags-todo "DEADLINE=\"\"+PRIORITY={A}|DEADLINE>\"<+1w>\"+PRIORITY={A}"
((org-agenda-overriding-header "HIGH PRIORITY"))))
((org-agenda-todo-ignore-scheduled 'future)
(org-agenda-sorting-strategy '(deadline-up)))))))
;; org babel related
;; prevent the conversion of spaces into tabs (necessary for Python code exports)
(org-src-fontify-natively t)
(org-src-preserve-indentation t)
(org-edit-src-content-indentation t)
;; behavior
;; I want to follow links on RET
(org-return-follows-link t)
(org-enforce-todo-dependencies t)
(org-export-with-toc nil)
(org-export-with-section-numbers nil)
;; A few abbreviations I use regularly
(org-link-abbrev-alist
'(("src" . "~/workspace/%s")
("jira" . "https://jira.twitter.biz/browse/%s")
("ph" . "https://phabricator.twitter.biz/%s")
("go" . "http://go/%s")))
;; entries
(org-blank-before-new-entry (quote ((heading . nil)
(plain-list-item . nil))))
;; see https://github.com/abo-abo/swiper/issues/986
(org-goto-interface 'outline-path-completion)
;; refile and capture
(org-refile-use-outline-path 'file)
(org-outline-path-complete-in-steps nil)
(org-refile-allow-creating-parent-nodes 'confirm)
(org-refile-targets (quote ((org-agenda-files :todo . "PROJECT")
(org-default-notes-file :maxlevel . 1))))
(org-stuck-projects (quote ("TODO=\"PROJECT\"" ("TODO") nil "")))
(org-reverse-note-order t)
(org-todo-keyword-faces
(quote
(("TODO" :foreground "medium blue" :weight bold)
("STARTED" :foreground "dark orange" :weight bold)
("WAITING" :foreground "red" :weight bold)
("DELEGATED" :foreground "dark violet" :weight bold)
("NOTE" :foreground "purple" :weight bold)
("PROJECT" :foreground "#088e8e" :weight bold)))
("SOMEDAY" :foreground "dark blue" :weight bold)
("MEETING" :foreground "deep sky blue" :weight bold))
(org-capture-templates
`(("t" "Add task" entry
(file ,org-default-inbox-file)
"* TODO %?\n:PROPERTIES:\n:ID: %(shell-command-to-string \"uuidgen\"):CREATED: %U\n:END:\n")
("m" "Meeting" entry
(file ,org-default-inbox-file)
"* MEETING %u %?\n:PROPERTIES:\n:ID: %(shell-command-to-string \"uuidgen\"):CREATED: %U\n:END:\n")
("n" "Note" entry
(file ,org-default-inbox-file)
"* NOTE %?\n:PROPERTIES:\n:ID: %(shell-command-to-string \"uuidgen\"):CREATED: %U\n:END:\n")
("j" "Journal" entry
(file+olp+datetree ,org-default-journal-file)
"* %?" :tree-type month))))
(use-package htmlize
:ensure t)
(defun fcuny/org-todo-age-time (&optional pos)
(let ((stamp (org-entry-get (or pos (point)) "CREATED" t)))
(when stamp
(time-subtract (current-time)
(org-time-string-to-time
(org-entry-get (or pos (point)) "CREATED" t))))))
(defun fcuny/org-todo-age (&optional pos)
(let ((days (time-to-number-of-days (fcuny/org-todo-age-time pos))))
(cond
((< days 1) "today")
((< days 7) (format "%dd" days))
((< days 30) (format "%.1fw" (/ days 7.0)))
((< days 358) (format "%.1fM" (/ days 30.0)))
(t (format "%.1fY" (/ days 365.0))))))
(provide 'fcuny-org)
|