-
Notifications
You must be signed in to change notification settings - Fork 9
/
org-config.el
348 lines (285 loc) · 12.4 KB
/
org-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
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
;;; org-config.el --- My Org mode configuration.
;;; Commentary:
;;; Author: Suvrat Apte
;;; Created on: 02 November 2015
;;; Copyright (c) 2021 Suvrat Apte <[email protected]>
;; This file is not part of GNU Emacs.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Do What The Fuck You Want to
;; Public License, Version 2, which is included with this distribution.
;; See the file LICENSE.txt
;;; Code:
;; My org mode setup is not generic yet. So I have added checks to make it
;; execute only if it's my computer.
;; ─────────────────────────────────────── *ORG* ──────────────────────────────────────
(use-package org
:if (or (equal user-login-name "suvratapte")
(equal user-login-name "suvrat"))
:config
;; Enable spell check in org
(add-hook 'org-mode-hook 'turn-on-flyspell)
(setq-default
org-list-demote-modify-bullet '(("+" . "-") ("-" . "+"))
;; Hide leading stars
org-hide-leading-stars t
;; Enable source code highlighting in org-mode.
org-src-fontify-natively t
;; '!' after the hotkey tells org-mode to add a LOGBOOK entry for every
;; status change.
org-todo-keywords '((sequence
"TODO(t)" "WORKING(w)" "WAITING(W)"
"|" "DONE(d!)"))
;; Use logbook
org-log-into-drawer t
;; Use clocking
org-clock-into-drawer "CLOCKING"
;; Add 'closed' log when marked done
org-log-done t
org-modules '(org-bbdb
org-bibtex
org-docview
org-gnus
org-habit
org-info
org-irc
org-mhe
org-rmail
org-w3m
;; After version 9.2, "<{char} TAB" expansion has been moved to
;; `org-tempo`.
org-tempo)
;; C-{a,e} should behave differently on headings
org-special-ctrl-a/e t
org-todo-keyword-faces-spacemacs-theme
'(("TODO" :foreground "red" :weight bold)
("WORKING" :foreground "#a45bad" :weight bold)
("WAITING" :foreground "cyan1" :weight bold)
("DONE" :foreground "#2d9574" :weight bold))
org-todo-keyword-faces-nord-theme
'(("TODO" :foreground "#bf616a" :weight bold)
("WORKING" :foreground "#b48ead" :weight bold)
("WAITING" :foreground "#ebcb8b" :weight bold)
("DONE" :foreground "#a3be8c" :weight bold))
org-todo-keyword-faces org-todo-keyword-faces-nord-theme
org-enforce-todo-dependencies t
org-enforce-todo-checkbox-dependencies t
;; When dependencies are enforced (by both vars above), agenda views highlight tasks
;; highlights blocked tasks i.e. tasks with incomplete sub tasks.
org-agenda-dim-blocked-tasks nil
org-habit-show-habits-only-for-today t
org-agenda-skip-scheduled-if-done t
org-agenda-skip-scheduled-if-deadline-is-shown t
org-agenda-skip-deadline-if-done t
org-agenda-custom-commands
'(("i" "My Agenda"
((agenda ""
((org-agenda-overriding-header "Agenda\n")
(org-agenda-span 3)))
;; (tags-todo "STYLE=\"habit\""
;; ((org-agenda-files (list org-habits-file))
;; (org-agenda-overriding-header "Habits\n")))
)
nil nil))
org-agenda-block-separator
(propertize
"────────────────────────────────────────────────────────────────────────\n"
'face '(:foreground "#81a1c1"))
;; Capture directories
org-directory "~/workspace/org"
org-personal-directory (concat org-directory "/personal")
org-work-directory (concat org-directory "/vara")
;; Capture files
org-personal-reading-list-file (concat org-personal-directory "/reading-list.org")
org-work-reading-list-file (concat org-work-directory "/reading-list.org")
org-oncall-file (concat org-work-directory "/oncall.org")
org-work-meeting-notes-file (concat org-work-directory "/meeting-notes.org")
org-personal-meeting-notes-file (concat org-personal-directory "/meeting-notes.org")
;; org-hscore-file (concat org-work-directory "/hscore.org")
org-work-todo-file (concat org-work-directory "/todo.org")
org-personal-todo-file (concat org-personal-directory "/todo.org")
;; org-habits-file (concat org-personal-directory "/habits.org")
org-til-file (concat org-personal-directory "/til.org")
org-capture-templates
'(("t" "Work todo item" entry (file org-work-todo-file)
"* TODO %^{Description}%?\n :LOGBOOK:\n - Added: %U\n :END:")
("T" "Work todo item" entry (file org-personal-todo-file)
"* TODO %^{Description}%?\n :LOGBOOK:\n - Added: %U\n :END:")
("m" "Work meeting notes" entry (file org-work-meeting-notes-file)
"* TODO %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] ")
("M" "Personal meeting notes" entry (file org-personal-meeting-notes-file)
"* TODO %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] ")
("r" "Work reading list item" entry (file org-work-reading-list-file)
"* TODO %^{Description}\n :LOGBOOK:\n - Added: %U\n :END:\n %x")
("R" "Personal reading list item" entry (file org-personal-reading-list-file)
"* TODO %^{Description}\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("o" "Oncall ticket" entry (file org-oncall-file)
"* TODO %^{Description}
:PROPERTIES:
:END:
:LOGBOOK:\n - Added - %U\n :END:" :prepend t)
;; ("h" "HSCore task" entry (file org-hscore-file)
;; "* TODO %^{Type|HSC}-%^{Ticket number} - %^{Description}
;; :PROPERTIES:
;; :LINK: https://helpshift.atlassian.net/browse/%\\1-%\\2
;; :END:
;; :LOGBOOK:\n - Added - %U\n :END:" :prepend t)
("l" "Today I learnt" entry (file org-til-file)
"* %^{Description}\n - Source: %?\n -"))
org-agenda-files (list org-oncall-file
;; Excluding the reading list file since it has many TODOs.
;; org-reading-list-file
org-work-todo-file
org-work-meeting-notes-file
org-work-reading-list-file
org-personal-meeting-notes-file
org-personal-todo-file
;; org-habits-file
)
;; Do not show clock in the modeline. It hides other important things.
org-clock-clocked-in-display 'frame-title)
(defun custom-agenda-view ()
"Show my custom agenda view."
(interactive)
(org-agenda nil "i")
(org-fit-window-to-buffer)
(org-agenda-redo))
(defun jump-to-org-agenda ()
"Jump to the agenda buffer.
Credits: John Wigley."
(interactive)
(when (not (minibufferp))
(let ((buf (get-buffer "*Org Agenda*"))
wind)
(if buf
(if (setq wind (get-buffer-window buf))
(select-window wind)
(if (called-interactively-p 'interactive)
(progn
(select-window (display-buffer buf t t))
(org-fit-window-to-buffer)
(org-agenda-redo))
(with-selected-window (display-buffer buf)
(org-fit-window-to-buffer)
(org-agenda-redo))))
(custom-agenda-view)))))
;; Temporarily disabled. It is not proving out to be useful enough.
;; (run-with-idle-timer 300 t 'jump-to-org-agenda)
(defun org-move-item-or-tree ()
(interactive)
(message "Use f, b, n, p to move items with subtrees. %s %s"
"F, B, N, P to move items without subtrees."
"C-{f,b,n,p} for point movement.")
(let ((map (make-sparse-keymap)))
(define-key map (kbd "f") 'org-shiftmetaright)
(define-key map (kbd "b") 'org-shiftmetaleft)
(define-key map (kbd "n") 'org-shiftmetadown)
(define-key map (kbd "p") 'org-shiftmetaup)
(define-key map (kbd "F") 'org-metaright)
(define-key map (kbd "B") 'org-metaleft)
(define-key map (kbd "N") 'org-metadown)
(define-key map (kbd "P") 'org-metaup)
(define-key map (kbd "C-f") 'forward-char)
(define-key map (kbd "C-b") 'backward-char)
(define-key map (kbd "C-n") 'next-line)
(define-key map (kbd "C-p") 'previous-line)
(set-transient-map map t)))
;; Copied from:
;; https://emacs.stackexchange.com/questions/13360/org-habit-graph-on-todo-list-agenda-view
(defvar my/org-habit-show-graphs-everywhere t
"If non-nil, show habit graphs in all types of agenda buffers.
Normally, habits display consistency graphs only in
\"agenda\"-type agenda buffers, not in other types of agenda
buffers. Set this variable to any non-nil variable to show
consistency graphs in all Org mode agendas.")
(defun my/org-agenda-mark-habits ()
"Mark all habits in current agenda for graph display.
This function enforces `my/org-habit-show-graphs-everywhere' by
marking all habits in the current agenda as such. When run just
before `org-agenda-finalize' (such as by advice; unfortunately,
`org-agenda-finalize-hook' is run too late), this has the effect
of displaying consistency graphs for these habits.
When `my/org-habit-show-graphs-everywhere' is nil, this function
has no effect."
(when (and my/org-habit-show-graphs-everywhere
(not (get-text-property (point) 'org-series)))
(let ((cursor (point))
item data)
(while (setq cursor (next-single-property-change cursor 'org-marker))
(setq item (get-text-property cursor 'org-marker))
(when (and item (org-is-habit-p item))
(with-current-buffer (marker-buffer item)
(setq data (org-habit-parse-todo item)))
(put-text-property cursor
(next-single-property-change cursor 'org-marker)
'org-habit-p data))))))
(advice-add #'org-agenda-finalize :before #'my/org-agenda-mark-habits)
;; org clock in and out should trigger state changes automatically.
;; This is extremely useful! :)
;; TODO: Figure out how this works.
(defadvice org-clock-in (after wicked activate)
"Set this task's status to 'WORKING'."
(org-todo "WORKING"))
(defadvice org-clock-out (after wicked activate)
"Set this task's status to 'WAITING'."
(org-todo "WAITING"))
:bind (:map
global-map
("C-c c" . org-capture)
("C-c a" . org-agenda)
("C-c l" . org-stored-links)
("C-c g" . org-clock-goto)
("C-c o" . jump-to-org-agenda)
("C-c b" . org-switchb)
:map
org-mode-map
("C-M-g" . org-move-item-or-tree)
("H-i" . org-clock-in)
("H-o" . org-clock-out)
("H-p" . org-set-property))
:delight)
(use-package org-bullets
:if (or (equal user-login-name "suvratapte")
(equal user-login-name "suvrat.apte"))
:ensure t
:config
(add-hook 'org-mode-hook 'org-bullets-mode)
(setq org-bullets-bullet-list '("♕" "♖" "♗" "♘" "♙"))
:delight)
(use-package org-super-agenda
:if (equal user-login-name "suvratapte")
:ensure t
:config
;; Configure this.
(setq org-super-agenda-groups
'((:name "Today"
:scheduled today
:deadline today)
(:name "Overdue"
:deadline past)
(:name "Personal"
:and (:tag "personal" :not (:tag "long_running")))
(:name "Personal - Long Running"
:and (:tag "personal" :tag "long_running"))
(:name "Work"
:and (:tag "work" :not (:tag "long_running")))
(:name "Work - Long Running"
:and (:tag "work" :tag "long_running"))
(:name "Habits - Today"
:tag "habit")))
;; (org-super-agenda-mode t)
)
(use-package org-roam
:ensure t
:config
(setq org-roam-directory (concat org-personal-directory "/org-roam"))
(setq org-roam-completion-everywhere t)
(org-roam-db-autosync-enable)
:bind (("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)))
(use-package org-roam-ui
:ensure t)
(provide 'org-config)
;;; org-config.el ends here