aboutsummaryrefslogtreecommitdiffstats
path: root/doom.d/config.el
blob: aaabf5267816c2a69c8ef6e51cd9f75d4df82937 (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
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
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!


;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
(setq user-full-name "Matthew Lemon"
      user-mail-address "matt@matthewlemon.com")

;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;;   presentations or streaming.
;; - `doom-unicode-font' -- for unicode glyphs
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
(setq doom-font (font-spec :family "Iosevka Regular" :size 16)
      doom-variable-pitch-font (font-spec :family "Iosevka Regular" :size 16))
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;;      doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!

;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
;; (setq doom-theme 'doom-laserwave)

(load-theme 'gruber-darker t)

;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type `relative)

;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
;;
;; --------------------
;; Some of my own stuff
;; --------------------
;; Open cider repl in vertical window
;; https://stackoverflow.com/questions/65992013/doom-emacs-move-cider-repl-windows-vertical
(after! cider
  (set-popup-rules!
   '(("^\\*cider-repl"
      :side right
      :width 100
      :quit nil
      :ttl nil))));
;;
;;Switch to scratch buffer
(defun mrl/switch-to-scratch ()
  (interactive)
  (switch-to-buffer "*scratch*"))
;;
;; --------------------
;; Custom keybindings
;; --------------------
(global-set-key (kbd "C-c s") 'mrl/switch-to-scratch)
(global-set-key (kbd "C-c r") 'counsel-rg)
(global-set-key (kbd "C-c f") 'counsel-fzf)
(global-unset-key (kbd "C-x C-b")) ;; we don't want the old buffer list!

;; org-roam
(after! org-roam
  (setq org-roam-directory ("~/org-roam"))
  (org-roam-db-autosync-mode)
  (setq org-roam-node-display-template
      (concat "${title:*} "
              (propertize "${tags:10}" 'face 'org-tag)))
  )

;; Basic agenda stuff

(after! org
  (setq org-modules '(org-habit ol-bibtex))
  (evil-set-initial-state 'org-capture-mode 'insert) ;; from https://www.reddit.com/r/emacs/comments/hzkyrb/org_capture_evil_go_into_insert_mode/
  (setq org-directory "~/org/")
  (setq org-startup-indented nil)
  (setq org-hide-leading-stars nil)
  (setq org-deadline-warning-days 4)
  (setq org-clock-persist 'history)
  (org-clock-persistence-insinuate)
  (setq org-agenda-span 'day)
  (setq org-agenda-start-day "today")
  (setq org-directory "~/org")
  (setq org-agenda-files (quote ("~/org/home.org"
                                 "~/org/projects.org"
                                 "~/org/refile.org"
                                 "~/org/journal.org"
                                 "~/org/mod.org"
                                 "~/org/notes.org"
                                 "~/org/habits.org")))
  (setq org-default-notes-file (concat org-directory "/notes.org"))
  (setq org-agenda-window-setup 'current-window)
  (setq org-agenda-start-with-log-mode t)
  (setq org-M-RET-may-split-line '(default . nil))
  (setq org-enforce-todo-dependencies t)
  (setq org-log-done 'time)
  (setq org-log-done-with-time 'note)
  (setq diary-file "~/org/diary")
  (setq org-agenda-include-diary nil)
  (setq org-agenda-diary-file "~/org/calendar/cal.org")
  (setq org-agenda-show-future-repeats t)
  (setq org-agenda-skip-deadline-if-done t)
  (setq org-agenda-skip-scheduled-if-done t)
  (setq org-reverse-note-order t)
  (setq +org-habit-min-width 45)
  (setq org-agenda-sort-notime-is-late nil)
  (setq org-columns-default-format "%50ITEM(Task) %10CLOCKSUM %25TIMESTAMP_IA")
  (setq org-archive-location "~/org/archive.org::* From %s")
  (setq org-refile-targets (quote ((nil :maxlevel . 9)
                                   (org-agenda-files :maxlevel . 9))))

  ;; set for sunrise, sunset in Berwick
  (setq calendar-latitude 55.77)
  (setq calendar-longitude -2.01)
  (setq calendar-location-name "Berwick-upon-Tweed")

  ;; Basic org keybindings
  (global-set-key "\C-cl" 'org-store-link)
  (global-set-key "\C-ca" 'org-agenda)
  (global-set-key "\C-cb" 'org-iswitchb)
  (global-set-key "\C-cc" 'org-capture)
  ;;
  ;; Agenda dispatcher
  (setq org-agenda-custom-commands
        '(
          ("D" "Dashboard"
           (
            (tags "current"
                  ((org-agenda-overriding-header "Current Ideas")))
            (tags-todo "PRIORITY=\"A\""
                       ((org-agenda-overriding-header "Urgent Tasks")))
            (agenda "")
            )
           )
          ("w" . "Work")
          ("wt" "Agenda + Work TODO"
           (
            (agenda "")
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"TODO\"-SCHEDULED>=\"<today>\"|CATEGORY=\"Work\"&TODO=\"TODO\"-SCHEDULED>=\"<today>\""
                       ((org-agenda-overriding-header "Work TODO UNSCHEDULED")))
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"WAITING\"|CATEGORY=\"Work\"&TODO=\"WAITING\""
                       ((org-agenda-overriding-header "Work WAITING")))
            )
           ((org-agenda-category-filter-preset '("+MOD" "+Work" "+Meeting")))
           )
          ("wn" "Agenda + Work NEXT"
           (
            (agenda)
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"NEXT\"-SCHEDULED>=\"<today>\"|CATEGORY=\"Work\"&TODO=\"NEXT\"-SCHEDULED>=\"<today>\""
                       ((org-agenda-overriding-header "Work NEXT UNSCHEDULED")))
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"WAITING\"|CATEGORY=\"Work\"&TODO=\"WAITING\""
                       ((org-agenda-overriding-header "Work WAITING")))
            )
           ((org-agenda-category-filter-preset '("+MOD" "+Work" "+Meeting")))
           )
          ("wp" "Work Project NEXT"
           (
            (agenda)
            (tags-todo "+CATEGORY=\"MOD\"TODO=\"NEXT\"+CATEGORY=\"Project\""
                       ((org-agenda-overriding-header "Work Project NEXT actions")))
            ))
          ("h" . "Home")
          ("hh" "Agenda + Home TODO"
           (
            (agenda)
            (tags-todo "+CATEGORY=\"home\"-SCHEDULED>=\"<today>\"-TODO=\"WAITING\"-TODO=\"DOING\""
                       ((org-agenda-overriding-header "Home TODO UNSCHEDULED")
                        (org-agenda-sorting-strategy '(deadline-down scheduled-down priority-down))))
            (tags-todo "+CATEGORY=\"home\"+TODO=\"WAITING\""
                       ((org-agenda-overriding-header "Home WAITING")))
            (tags-todo "+CATEGORY=\"home\"+TODO=\"DOING\"" ((org-agenda-overriding-header "Home in progress")))
            )
           ((org-agenda-category-filter-preset '("+home")))
           )
          ("hn" "Agenda + Home NEXT"
           (
            (agenda "")
            (tags-todo "+CATEGORY=\"home\"+TODO=\"NEXT\"-SCHEDULED>=\"<today>\""
                       ((org-agenda-overriding-header "Home NEXT UNSCHEDULED")
                        (org-agenda-sorting-strategy '(deadline-down scheduled-down priority-down))))
            (tags-todo "+CATEGORY=\"home\"+TODO=\"DOING\""
                       ((org-agenda-overriding-header "Home in progress")))
            )
           ((org-agenda-category-filter-preset '("+home")))
           )
          ("n" "Agenda + All NEXT"
           (
            (agenda "")
            (todo "NEXT")))
          ("t" "Agenda + All TODO"
           (
            (agenda "")
            (alltodo "")))
          ("W" "Agenda + All WAITING"
           (
            (agenda "")
            (todo "WAITING")))
          ("i" tags "idea")
          ("R" tags-todo "REFILE"
           ((org-agenda-overriding-header "Review these pages captured from the web")))
          ))

  ;; org capture templates
  (setq org-capture-templates
        (quote (("h" "Home Tasks & Notes")
                ;; ("w" "Protocol Capture" entry (file+headline "~/org/refile.org" "Web Capture")
                ;;  "* %^{Title or Comment}\nDescription: %:description\nSource: %:link\n%:initial\nCaptured: %U\n")
                ("x" "Protocol Capture" entry (file+headline "~/org/refile.org" "Web Capture")
                 "* TODO Review %:description\nSource: %:link\n%:initial\nCaptured: %U\n" :immediate-finish t)
                ("w" "Protocol Capture" entry (file+headline "~/org/refile.org" "Web Capture")
                 "* %:description\nSource: %:link\n%:initial\nCaptured: %U\n")
                ("ht" "Home TODO" entry (file+headline "~/org/home.org" "Tasks")
                 "** TODO %?\nEntered on %U\n"
                 :prepend t)
                ("hn" "Home NEXT" entry (file+headline "~/org/home.org" "Tasks")
                 "** NEXT %?\nEntered on %U\n"
                 :prepend t)
                ("hS" "Home Someday" entry (file+headline "~/org/home.org" "Someday")
                 "** SOMEDAY %?\nEntered on %U\n")
                ("hN" "Home Note" entry (file+headline "~/org/home.org" "Notes")
                 "** %?\nEntered on %U\n")
                ("hj" "Journal" entry (file+olp+datetree "~/org/home.org" "Journal")
                 "* %?\nEntered on %U\n")
                ("hi" "Home Idea" entry (file+headline "~/org/home.org" "Notes")
                 "** %? :idea:\nEntered on %U\n")
                ("hc" "Home Calendar - Single" entry (file+headline "~/org/home.org" "Calendar")
                 "* %?\n%^T")
                ("hb" "Home Calendar - Block" entry (file+headline "~/org/home.org" "Calendar")
                 "* %?\n%^t--%^t")
                ("w" "Work Tasks & Notes")
                ("wt" "Work TODO" entry (file+headline "~/org/mod.org" "Tasks")
                 "** TODO %?\nEntered on %U\n"
                 :prepend t)
                ("wn" "Work NEXT" entry (file+headline "~/org/mod.org" "Tasks")
                 "** NEXT %?\nEntered on %U\n"
                 :prepend t)
                ("wS" "Work Someday" entry (file+headline "~/org/mod.org" "Someday")
                 "** SOMEDAY %?\nEntered on %U\n")
                ("wN" "Note" entry (file+headline "~/org/mod.org" "Notes")
                 "* %?\nEntered on %U\n")
                ("wc" "Note from Clipboard" entry (file+headline "~/org/mod.org" "Notes")
                 "* %?\n\t\n%c")
                ("wr" "Note from Region" entry (file+headline "~/org/mod.org" "Notes")
                 "* %?\n\t\n%i")
                ("wj" "Journal" entry (file+olp+datetree "~/org/mod.org" "Journal")
                 "* %?\nEntered on %U\n")
                ("wd" "Retrospective Tasks" entry (file+headline "~/org/mod.org" "Tasks")
                 "* DONE %?\nCLOSED: %U")
                ("ws" "Work Calendar - Single" entry (file+headline "~/org/mod.org" "Calendar")
                 "* %?\n%^T")
                ("wb" "Work Calendar - Block" entry (file+headline "~/org/mod.org" "Calendar")
                 "* %?\n%^t--%^t")
                ("wp" "Work Calendar - Trip" entry (file+headline "~/org/mod.org" "Work Trips")
                 "* %?\n%^t--%^t")
                ("wm" "Work Calendar - Meeting" entry (file+headline "~/org/mod.org" "Meetings")
                 "* %?\n:PROPERTIES:\n:CATEGORY: Meeting\n:END:\n%^T")
                ("e" "Emacs Tip")
                ("et" "Emacs Tip" entry (file+headline "~/org/emacs-tips.org" "Emacs Tips")
                 "* %?\n\t%a")
                ("er" "Emacs Tip from Region" entry (file+headline "~/org/emacs-tips.org" "Emacs Tips")
                 "* %?\n\t%i")
                )))
  ;; org tags
  (setq org-tag-alist '(
                        ;; Depth
                        ("@immersive" . ?i) ;; "Deep"
                        ("@process" . ?p)   ;; "Shallow"
                        ("@offdesk" . ?o)   ;; "Away from desk"
                        ;; Type
                        ("brainstorm" . ?b)
                        ("idea" . ?d)
                        ;; Context
                        ("@work" . ?w)
                        ("@home" . ?h)
                        ("@errand" . ?e)
                        ("@emacs" . ?E)
                        ;; Energy
                        ("Challenge" . ?1)
                        ("Average" . ?2)
                        ("Easy" . ?3)
                        ;; Misc
                        ("Maybe" . ?m)
                        ))

  ;; org agenda should be full screen
  (defun open-agenda ()
    "Open the org-agenda."
    (interactive)
    (let ((agenda "*Org Agenda*"))
      (if (equal (get-buffer agenda) nil)
          (org-agenda-list)
        (unless (equal (buffer-name (current-buffer)) agenda)
          (switch-to-buffer agenda))
        (org-agenda-redo t)
        (beginning-of-buffer))))

  ;; Defining stuck projects
  (setq org-stuck-projects
        '("/+PROJ" ("NEXT") nil ""))

  ;; Put state transition logs into a drawer called LOGBOOK
  (setq org-log-into-drawer t)

  (setq org-todo-keywords
        (quote ((sequence "TODO(t)" "NEXT(n)" "DOING(D)" "PROJ(p)"  "|" "DONE(d!)")
                (sequence "WAITING(w@/!)" "SOMEDAY(s@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)")
                )))

  (setq org-todo-keyword-faces
        (quote (("TODO" :foreground "red" :weight bold)
                ("NEXT" :foreground "cyan" :weight bold)
                ("PROJ" :foreground "pink" :weight bold)
                ("DOING" :foreground "orchid" :weight bold)
                ("DONE" :foreground "forest green" :weight bold)
                ("WAITING" :foreground "orange" :weight bold)
                ("SOMEDAY" :foreground "blue" :weight bold)
                ("HOLD" :foreground "magenta" :weight bold)
                ("CANCELLED" :foreground "forest green" :weight bold))))

  ;; tag stuff automatically dependent on a change of state
  (setq org-todo-state-tags-triggers
        (quote (("CANCELLED" ("CANCELLED" . t))
                ("WAITING" ("WAITING" . t))
                ("HOLD" ("WAITING") ("HOLD" . t))
                (done ("WAITING") ("HOLD"))
                ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
                ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
                ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))

  ;; Get more priority options
  (setq org-highest-priority ?A)
  (setq org-default-priority ?C)
  (setq org-lowest-priority ?E)

  (setq org-priority-faces
        '((?A . (:foreground "#CC0000" :background "#FFE3E3"))
          (?B . (:foreground "#64992C" :background "#EBF4DD"))
          (?C . (:foreground "#64992C" :background "#FFFFFF"))))
  (setq org-ellipsis "...")
  )

(after! deft
  (setq deft-recursive t))

;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
;;
;;   (after! PACKAGE
;;     (setq x y))
;;
;; The exceptions to this rule:
;;
;;   - Setting file/directory variables (like `org-directory')
;;   - Setting variables which explicitly tell you to set them before their
;;     package is loaded (see 'C-h v VARIABLE' to look up their documentation).
;;   - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;;   this file. Emacs searches the `load-path' when you load packages with
;;   `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.