forked from suvratapte/dot-emacs-dot-d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
org-config.el
442 lines (370 loc) · 16.9 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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
;;; 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 "rhishikesh")
(equal user-login-name "rhishikeshj"))
:config
;; Enable spell check in org
(add-hook 'org-mode-hook 'turn-on-flyspell)
(add-hook 'org-mode-hook 'org-indent-mode)
(add-hook 'org-mode-hook 'visual-line-mode)
(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!)"
"IN-REVIEW(r)"
"PAUSED(p!)"
"WAITING(W!)"
"|"
"CANCELED(c!)"
"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)
("PAUSED" :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)
("PAUSED" :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-spacemacs-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))))
nil nil))
org-agenda-block-separator
(propertize
"────────────────────────────────────────────────────────────────────────\n"
'face '(:foreground "#81a1c1"))
;; Capture directories
org-directory "~/workspace/notes"
org-personal-directory (concat org-directory "/personal")
org-work-directory (concat org-directory "/work/juxt")
org-saas0-work-directory (concat org-directory "/work/saas0")
org-capture-templates-directory "~/.emacs.d/org/templates/"
;; Capture files
org-reading-list-file (concat org-personal-directory "/reading-list.org")
org-oncall-file (concat org-work-directory "/oncall.org")
org-daily-journal-file (concat org-work-directory "/journal.org")
org-significants-file (concat org-work-directory "/significants.org")
org-saas0-daily-journal-file (concat org-saas0-work-directory "/journal.org")
org-meeting-notes-file (concat org-work-directory "/meeting-notes.org")
org-saas0-meeting-notes-file (concat org-saas0-work-directory "/meeting-notes.org")
org-personal-todo-file (concat org-personal-directory "/todo.org")
org-work-todo-file (concat org-work-directory "/todo.org")
org-saas0-work-todo-file (concat org-saas0-work-directory "/todo.org")
org-til-file (concat org-personal-directory "/til.org")
org-clj-til-file (concat org-personal-directory "/til-clojure.org")
org-ex-til-file (concat org-personal-directory "/til-elixir.org")
org-learn-file (concat org-personal-directory "/learn.org")
org-facts-file (concat org-personal-directory "/facts.org")
org-capture-templates
'(("r" "Reading list item" entry (file org-reading-list-file)
"* TODO %^{Description}\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("m" "Meeting notes")
("mj" "Meeting notes" entry (file org-meeting-notes-file)
"* %^{Title}\n - Attendees: %^{Attendees}
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] ")
("ms" "Meeting notes" entry (file org-saas0-meeting-notes-file)
"* %^{Title}\n - Attendees: %^{Attendees}
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] ")
("d" "Daily journal entries")
("dj" "Juxt Daily Entry" entry (file org-daily-journal-file)
(file "~/.emacs.d/org/templates/daily-entry.org") :prepend t)
("ds" "SaaS0 Daily Entry" entry (file org-saas0-daily-journal-file)
(file "~/.emacs.d/org/templates/daily-entry.org") :prepend t)
("L" "To learn" entry (file org-learn-file)
(file "~/.emacs.d/org/templates/learn.org"))
("t" "TODO")
("tp" "Personal todo item" entry (file org-personal-todo-file)
"* TODO [#%^{Priority (1 highest, 5 lowest)}] %^{Description}%?\n :LOGBOOK:\n - Added: %U\n :END:")
("tw" "Work TODO")
("twj" "Work todo item[Juxt]" entry (file org-work-todo-file)
"* TODO [#%^{Priority (1 highest, 5 lowest)}] %^{Description}%?\n :LOGBOOK:\n - Added: %U\n :END:")
("tws" "Work todo item[Saas0]" entry (file org-saas0-work-todo-file)
"* TODO [#%^{Priority (1 highest, 5 lowest)}] %^{Description}%?\n :LOGBOOK:\n - Added: %U\n :END:")
("l" "Today I learnt")
("lc" "clj: Today I learnt" entry (file org-clj-til-file)
"* %^{Description}\n - Source: %?\n -")
("le" "elixir: Today I learnt" entry (file org-ex-til-file)
"* %^{Description}\n - Source: %?\n -")
("ll" "Today I learnt" entry (file org-til-file)
"* %^{Description}\n - Source: %?\n -")
("f" "Facts" entry (file org-facts-file)
"* %^{Fact}\n")
("s" "Significants" entry (file org-significants-file)
(file "~/.emacs.d/org/templates/significants.org") :prepend t))
org-agenda-files (list org-personal-todo-file
org-learn-file
org-daily-journal-file)
;; Do not show clock in the modeline. It hides other important things.
org-clock-clocked-in-display 'frame-title
org-indent-mode t
;;WARN: potentially hazardous
org-confirm-babel-evaluate nil)
(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 'PAUSED'."
(org-todo "PAUSED"))
: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)
("C-c M-i" . org-id-store-link))
:delight)
(use-package org-bullets
:if (equal user-login-name "rhishikeshj")
: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 "rhishikeshj")
: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
:custom
(org-roam-directory "~/workspace/notes/roam-notes")
(org-roam-complete-everywhere)
(setq org-roam-capture-templates-directory (concat org-capture-templates-directory "/roam"))
(org-roam-capture-templates '(("d" "default" plain "* %?"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+date: %U\n")
:unnarrowed t)
("r" "Reading list item"
plain
"* TODO %^{Description}\n :LOGBOOK:\n - Added: %U\n :END:\n %?"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n")
:unnarrowed t)
("l" "Learn something new"
plain
(file "~/.emacs.d/org/templates/roam/learn.org")
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n")
:unnarrowed t)
("j" "Jot something down"
plain
(file "~/.emacs.d/org/templates/roam/note.org")
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n")
:unnarrowed t)))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
("C-c n d" . org-roam-db-sync)
:map org-mode-map
("C-M-i" . completion-at-point))
:config
(org-roam-db-autosync-enable))
;; ─────────────────────────────── org-tree-slide ───────────────────────────────
(defun efs/presentation-start ()
"Set text scale on presentation start."
(setq-local text-scale-mode-amount 2)
(org-display-inline-images)
(text-scale-mode 1))
(defun efs/presentation-end ()
"Reset text scale on presentation end."
(text-scale-mode 0))
(use-package org-tree-slide
:hook ((org-tree-slide-play . efs/presentation-start)
(org-tree-slide-stop . efs/presentation-end))
:custom
(org-image-actual-width nil)
(org-tree-slide-breadcrumbs " -> "))
;; ──────────────────────────────── org-roam-ui ───────────────────────────────
(use-package org-roam-ui
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t)
:delight)
;; ────────────────────────────── org-babel-config ──────────────────────────────
(use-package ob-clojurescript
:custom
(setq org-babel-clojure-backend 'cider))
(use-package ob-elixir)
(use-package ob-async)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(elixir . t)
(clojure . t)
(shell . t)))
(defun org-syntax-table-modify ()
"Modify `org-mode-syntax-table' for the current org buffer."
(modify-syntax-entry ?< "." org-mode-syntax-table)
(modify-syntax-entry ?> "." org-mode-syntax-table))
(add-hook 'org-mode-hook #'org-syntax-table-modify)
(use-package org-beautify-theme)
;; ───────────────────────────── /org-babel-config ────────────────────────────
(provide 'org-config)
;;; org-config.el ends here