~willvaughn/.emacs.d

ref: 6daf7dca067c3258073e99200c76710bc5fd6350 .emacs.d/lisp/wv-org.el -rw-r--r-- 6.4 KiB
6daf7dcaWilliam Vaughn add nygard rss feed, change default elfeed to include read items 4 months ago
                                                                                
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
;;; lisp/wv-org.el -*- lexical-binding: t; -*-

(defvar wv-org/org-capture-notes-file "roam/index.org"
  "Default target for storing notes.

Is relative to `org-directory'.")

(defvar wv-org/org-directory "~/aqbjj-jxkrm/org"
  "Default for everything Org-mode.")

(defvar wv-org/gcal-file "gcal.org"
  "Default target for org-gcal events.

Is relative to `org-directory'.")

(defvar wv-org/gcal-email)

(defun wv-org/org-init-h ()
  (yas-minor-mode +1)
  (visual-line-mode +1))

(defun wv-org/org-copy-link-url ()
  "Copy plain url from an org link at point."
  (interactive)
  (kill-new (org-element-property :raw-link (org-element-context))))

(defun wv-org/org-copy-full-link ()
  "Copy org link at point, including formatting text, useful when copy/pasting within org-mode buffer."
  (interactive)
  (let ((begin (org-element-property :begin (org-element-context)))
        (end (org-element-property :end (org-element-context))))
    (kill-ring-save begin end)))

(use-package org
  :hook ((org-mode . wv-org/org-init-h))
  :bind (("C-c A" . org-agenda)
         ("C-c X" . org-capture)
         :map org-mode-map
         ("C-M-<return>" . org-insert-subheading)
         ("C-c l u" . wv-org/org-copy-link-url)
         ("C-c l c" . wv-org/org-copy-full-link))
  :config
  (setq org-directory wv-org/org-directory
        org-default-notes-file (expand-file-name wv-org/org-capture-notes-file org-directory)
        org-confirm-babel-evaluate t
        org-log-into-drawer t
        org-log-done 'time
        org-startup-indented t
        org-refile-targets '((nil . (:maxlevel . 2)))
        org-refile-use-outline-path t
        org-outline-path-complete-in-steps nil
        org-refile-allow-creating-parent-nodes 'confirm
        org-agenda-files (list org-default-notes-file
                               (expand-file-name wv-org/gcal-file org-directory))
        org-tag-alist '((:startgroup . nil)
                        ("@home" . ?h)
                        ("@work" . ?w)
                        (:endgroup . nil)
                        ("@meegan" . ?m)
                        ("@bogey" . ?b)
                        ("@grady" . ?g)
                        ("@owen" . ?o))
        org-todo-keywords '((sequence
                             "TODO(t)"
                             "NEXT(n)"
                             "WAITING(w)"
                             "|"
                             "DONE(d)"
                             "CANCELED(c)")
                            (sequence
                             "[ ](T)"
                             "[-](S)"   ; Task is in progress
                             "[?](W)"   ; Task is being held up or paused "|"
                             "[X](D)")) ; Task is completed
        ;; NOTE: I override a lot of default org-capture-templates that doom gives you out of the box.
        org-capture-templates '(("t" "GTD Todo" entry
                                 (file+headline org-default-notes-file "Inbox")
                                 (file "capture_templates/todo.org")
                                 :prepend t)
                                ("n" "Meeting note" entry
                                 (file buffer-name)
                                 (file "capture_templates/meeting.org"))
                                ("r" "GTD Reminder (tickler)" entry
                                 (file+headline org-default-notes-file "Tickler")
                                 (file "capture_templates/reminder.org")
                                 :prepend t)
                                ("m" "Email Workflow")
                                ("mf" "Follow Up" entry
                                 (file+olp org-default-notes-file "Follow Up")
                                 "* TODO Follow up on %:subject by %:from\nSCHEDULED:%t\n%a\n\n%i"
                                 :immediate-finish t)
                                ("mr" "Read Later" entry
                                 (file+olp org-default-notes-file "Read Later")
                                 "* TODO Read %:subject by %:from\nSCHEDULED:%t\n%a\n\n%i"
                                 :immediate-finish t)
                                ("o" "One-on-One")
                                ("oo" "o3" entry
                                 (file+olp+datetree buffer-name)
                                 (file "capture_templates/o3.org"))
                                ("op" "Peer o3" entry
                                 (file+olp+datetree buffer-name)
                                 (file "capture_templates/o3-peer.org"))
                                ("os" "Skip-level o3" entry
                                 (file+olp+datetree buffer-name)
                                 (file "capture_templates/o3-skip-level.org"))
                                ("w" "Weekly Review" entry
                                 (file buffer-name)
                                 (file "capture_templates/weekly-review.org")))))

(use-package ox-hugo
  :after ox)

(use-package org-roam
  :after org
  :custom
  (org-roam-directory
   (thread-first
     "roam"
     (expand-file-name org-directory)
     (file-truename)
     (file-name-as-directory)))
  (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)
     ("p" "Person" plain
      (file "capture_templates/person.org")
      :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+date: %U\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 X" . org-roam-capture)
         ;; Dailies
         ("C-c n t" . org-roam-dailies-goto-today)
         ("C-c n y" . org-roam-dailies-goto-yesterday)
         ("C-c n m" . org-roam-dailies-goto-tomorrow)
         ("C-c n d" . org-roam-dailies-goto-date))
  :config
  (org-roam-db-autosync-mode))

(use-package org-gcal
  :after (org)
  :bind (:map org-mode-map
         ("C-c F" . org-gcal-fetch)
         :map org-agenda-mode-map
         ("C-c F" . org-gcal-fetch))
  :config
  (let ((org-gcal-creds (wv/get-authinfo "org.gcal.creds" "9999")))
    (setq org-gcal-client-id (plist-get org-gcal-creds :user)
          org-gcal-client-secret (plist-get org-gcal-creds :secret)
          org-gcal-file-alist `((,wv-org/gcal-email . ,(expand-file-name wv-org/gcal-file org-directory))))))

(provide 'wv-org)