diff options
Diffstat (limited to '.emacs.d/jd/jd-org.el')
-rwxr-xr-x | .emacs.d/jd/jd-org.el | 375 |
1 files changed, 182 insertions, 193 deletions
diff --git a/.emacs.d/jd/jd-org.el b/.emacs.d/jd/jd-org.el index a9565f3..ff15b59 100755 --- a/.emacs.d/jd/jd-org.el +++ b/.emacs.d/jd/jd-org.el | |||
@@ -13,199 +13,188 @@ | |||
13 | (visual-line-mode 1)) | 13 | (visual-line-mode 1)) |
14 | 14 | ||
15 | (defun jd-emacs/org-insert-date (&optional date) | 15 | (defun jd-emacs/org-insert-date (&optional date) |
16 | (let ((d (or date "+0d"))) | 16 | (org-insert-time-stamp (org-read-date nil t (or date "+0d")))) |
17 | (org-insert-time-stamp (org-read-date nil t d)))) | 17 | |
18 | 18 | (use-package! org-pomodoro "emacs-org-pomodoro") | |
19 | (jd/use-package org-pomodoro "emacs-org-pomodoro") | 19 | |
20 | 20 | (use-package! org "emacs-org" | |
21 | (jd/use-package org "emacs-org" | 21 | :pin org |
22 | :pin org | 22 | :commands (org-capture org-agenda) |
23 | :commands (org-capture org-agenda) | 23 | :hook (org-mode . jd/org-mode-init) |
24 | :hook (org-mode . jd/org-mode-init) | 24 | :bind |
25 | :bind | 25 | ("C-c o c" . #'org-capture) |
26 | ("C-c o c" . #'org-capture) | 26 | ("C-c o p" . #'org-mobile-pull) |
27 | ("C-c o p" . #'org-mobile-pull) | 27 | ("C-c o P" . #'org-mobile-push) |
28 | ("C-c o P" . #'org-mobile-push) | 28 | ("C-c o a" . #'org-agenda) |
29 | ("C-c o a" . #'org-agenda) | 29 | :config |
30 | :config | 30 | (setq org-directory (file-truename "~/Documents/Org/")) |
31 | (setq org-directory (file-truename "~/Documents/Org/")) | 31 | (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org")) |
32 | (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org")) | 32 | (setq org-mobile-directory "~/Documents/Org/Mobile/") |
33 | (setq org-mobile-directory "~/Documents/Org/Mobile/") | 33 | (setq org-agenda-files '("Tasks.org" "Inbox.org" "Habits.org")) |
34 | (setq org-agenda-files '("Tasks.org" "Inbox.org" "Habits.org")) | 34 | (setq org-ellipsis " ▾") |
35 | (setq org-ellipsis " ▾") | 35 | (setq org-agenda-start-with-log-mode t) |
36 | (setq org-agenda-start-with-log-mode t) | 36 | (setq org-log-done 'time) |
37 | (setq org-log-done 'time) | 37 | (setq org-log-into-drawer t) |
38 | (setq org-log-into-drawer t) | 38 | (setq org-return-follows-link t) |
39 | (setq org-return-follows-link t) | 39 | (setq org-capture-templates |
40 | (setq org-capture-templates | 40 | `(("t" "Tasks / Projects") |
41 | `(("t" "Tasks / Projects") | 41 | ("tt" "Task" entry (file+olp "Tasks.org" "Inbox") |
42 | ("tt" "Task" entry (file+olp "Tasks.org" "Inbox") | 42 | "* TODO %?\n %t\n %a\n %i" :empty-lines 1) |
43 | "* TODO %?\n %t\n %a\n %i" :empty-lines 1) | 43 | ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox") |
44 | ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox") | 44 | "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1) |
45 | "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1) | 45 | |
46 | 46 | ("m" "Metrics Capture") | |
47 | ("m" "Metrics Capture") | 47 | ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics") |
48 | ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics") | 48 | "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t) |
49 | "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t) | 49 | ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org")))) |
50 | ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org")))) | 50 | |
51 | 51 | (setq org-latex-listings 'minted | |
52 | (setq org-latex-listings 'minted | 52 | org-latex-packages-alist '(("" "minted")) |
53 | org-latex-packages-alist '(("" "minted")) | 53 | org-latex-pdf-process |
54 | org-latex-pdf-process | 54 | '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" |
55 | '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" | 55 | "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) |
56 | "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) | 56 | (require 'org-tempo) |
57 | (require 'org-tempo) | 57 | |
58 | 58 | (defun jd/org-font-setup () | |
59 | 59 | ;; Replace list hyphen with dot | |
60 | (jd/leader-key-def | 60 | (font-lock-add-keywords 'org-mode |
61 | "o" '(:ignore t :which-key "Open/Org") | 61 | '(("^ *\\([-]\\) " |
62 | "oc" '(org-capture :which-key "Open org-capture") | 62 | (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) |
63 | "oop" '(org-mobile-pull :which-key "Org mobile pull") | 63 | |
64 | "ooP" '(org-mobile-push :which-key "Org mobile push") | 64 | ;; Set faces for heading levels |
65 | "oa" '(org-agenda :which-key "Open org-agenda")) | 65 | (dolist (face '((org-level-1 . 1.3) |
66 | 66 | (org-level-2 . 1.2) | |
67 | 67 | (org-level-3 . 1.1) | |
68 | (defun jd/org-font-setup () | 68 | (org-level-4 . 1.0) |
69 | ;; Replace list hyphen with dot | 69 | (org-level-5 . 1.0) |
70 | (font-lock-add-keywords 'org-mode | 70 | (org-level-6 . 1.0) |
71 | '(("^ *\\([-]\\) " | 71 | (org-level-7 . 1.0) |
72 | (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) | 72 | (org-level-8 . 1.0))) |
73 | 73 | (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face))) | |
74 | ;; Set faces for heading levels | 74 | |
75 | (dolist (face '((org-level-1 . 1.3) | 75 | ;; Ensure that anything that should be fixed-pitch in Org files appears that way |
76 | (org-level-2 . 1.2) | 76 | (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100) |
77 | (org-level-3 . 1.1) | 77 | (set-face-attribute 'org-table nil :inherit 'fixed-pitch) |
78 | (org-level-4 . 1.0) | 78 | (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) |
79 | (org-level-5 . 1.0) | 79 | (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) |
80 | (org-level-6 . 1.0) | 80 | (set-face-attribute 'org-table nil :font "Terminus" :inherit '(shadow fixed-pitch)) |
81 | (org-level-7 . 1.0) | 81 | (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) |
82 | (org-level-8 . 1.0))) | 82 | (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) |
83 | (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face))) | 83 | (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) |
84 | 84 | (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) | |
85 | ;; Ensure that anything that should be fixed-pitch in Org files appears that way | 85 | (set-face-attribute 'line-number nil :inherit 'fixed-pitch) |
86 | (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100) | 86 | (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) |
87 | (set-face-attribute 'org-table nil :inherit 'fixed-pitch) | 87 | |
88 | (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) | 88 | (with-eval-after-load 'org (jd/org-font-setup)) |
89 | (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) | 89 | |
90 | (set-face-attribute 'org-table nil :font "Terminus" :inherit '(shadow fixed-pitch)) | 90 | (defun jd-emacs/org-timer-stop () |
91 | (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) | 91 | (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie")) |
92 | (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) | 92 | |
93 | (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) | 93 | |
94 | (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) | 94 | (add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop) |
95 | (set-face-attribute 'line-number nil :inherit 'fixed-pitch) | 95 | |
96 | (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) | 96 | (defun jd/org-tempo-setup () |
97 | 97 | (dolist (template '(("s" . "src") | |
98 | (with-eval-after-load 'org (jd/org-font-setup)) | 98 | ("sql" . "src sql") |
99 | 99 | ("sh" . "src sh") | |
100 | (defun jd-emacs/org-timer-stop () | 100 | ("el" . "src emacs-lisp") |
101 | (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie")) | 101 | ("li" . "src lisp") |
102 | 102 | ("sc" . "src scheme") | |
103 | 103 | ("ts" . "src typescript") | |
104 | (add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop) | 104 | ("py" . "src python") |
105 | 105 | ("go" . "src go") | |
106 | (defun jd/org-tempo-setup () | 106 | ("yaml" . "src yaml"))) |
107 | (add-to-list 'org-structure-template-alist '("s" . "src")) | 107 | (add-to-list 'org-structure-template-alist template))) |
108 | (add-to-list 'org-structure-template-alist '("sql" . "src sql")) | 108 | |
109 | (add-to-list 'org-structure-template-alist '("sh" . "src sh")) | 109 | (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) |
110 | (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) | 110 | |
111 | (add-to-list 'org-structure-template-alist '("li" . "src lisp")) | 111 | (org-babel-do-load-languages |
112 | (add-to-list 'org-structure-template-alist '("sc" . "src scheme")) | 112 | 'org-babel-load-languages |
113 | (add-to-list 'org-structure-template-alist '("ts" . "src typescript")) | 113 | '((emacs-lisp . t) |
114 | (add-to-list 'org-structure-template-alist '("py" . "src python")) | 114 | (python . t))) |
115 | (add-to-list 'org-structure-template-alist '("go" . "src go")) | 115 | |
116 | (add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))) | 116 | (defun jd/org-babel-tangle-config () |
117 | 117 | (when (string-equal (file-name-directory (buffer-file-name)) | |
118 | (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) | 118 | (expand-file-name "~/dotfiles/")) |
119 | 119 | ;; Dynamic scoping to the rescue | |
120 | (org-babel-do-load-languages | 120 | (let ((org-confirm-babel-evaluate nil)) |
121 | 'org-babel-load-languages | 121 | (org-babel-tangle)))) |
122 | '((emacs-lisp . t) | 122 | |
123 | (python . t))) | 123 | (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config)))) |
124 | 124 | ||
125 | (defun jd/org-babel-tangle-config () | 125 | (use-package! org-superstar "emacs-org-superstar" |
126 | (when (string-equal (file-name-directory (buffer-file-name)) | 126 | :hook (org-mode . org-superstar-mode) |
127 | (expand-file-name "~/dotfiles/")) | 127 | :init |
128 | ;; Dynamic scoping to the rescue | 128 | (setq org-superstar-special-todo-items t) |
129 | (let ((org-confirm-babel-evaluate nil)) | 129 | (setq org-superstar-remove-leading-stars t) |
130 | (org-babel-tangle)))) | 130 | (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) |
131 | 131 | ||
132 | (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config))) | 132 | (use-package! org-roam "emacs-org-roam" |
133 | ) | 133 | :custom |
134 | 134 | (org-roam-directory (file-truename jd/org-roam-home)) | |
135 | (jd/use-package org-superstar "emacs-org-superstar" | 135 | :bind (("C-c n l" . org-roam-buffer-toggle) |
136 | :hook (org-mode . org-superstar-mode) | 136 | ("C-c n f" . org-roam-node-find) |
137 | :init | 137 | ("C-c n g" . org-roam-graph) |
138 | (setq org-superstar-special-todo-items t) | 138 | ("C-c n i" . org-roam-node-insert) |
139 | (setq org-superstar-remove-leading-stars t) | 139 | ("C-c n c" . org-roam-capture) |
140 | (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) | 140 | ;; Dailies |
141 | 141 | ("C-c n j" . org-roam-dailies-capture-today)) | |
142 | (jd/use-package org-roam "emacs-org-roam" | 142 | :bind-keymap |
143 | :custom | 143 | ("C-c n d" . org-roam-dailies-map) |
144 | (org-roam-directory (file-truename jd/org-roam-home)) | 144 | :config |
145 | :bind (("C-c n l" . org-roam-buffer-toggle) | 145 | (defun jd/org-roam-filter-by-tag (tag-name) |
146 | ("C-c n f" . org-roam-node-find) | 146 | (lambda (node) |
147 | ("C-c n g" . org-roam-graph) | 147 | (member tag-name (org-roam-node-tags node)))) |
148 | ("C-c n i" . org-roam-node-insert) | 148 | |
149 | ("C-c n c" . org-roam-capture) | 149 | (defun jd/org-roam-list-notes-by-tag (tag-name) |
150 | ;; Dailies | 150 | (mapcar #'org-roam-node-file |
151 | ("C-c n j" . org-roam-dailies-capture-today)) | 151 | (seq-filter |
152 | :bind-keymap | 152 | (jd/org-roam-filter-by-tag tag-name) |
153 | ("C-c n d" . org-roam-dailies-map) | 153 | (org-roam-node-list)))) |
154 | :config | 154 | |
155 | (defun jd/org-roam-filter-by-tag (tag-name) | 155 | (defun jd/org-roam-refreshagenda-list () |
156 | (lambda (node) | 156 | (interactive) |
157 | (member tag-name (org-roam-node-tags node)))) | 157 | (setq org-agenda-files (org-roam-list-files))) |
158 | 158 | ||
159 | (defun jd/org-roam-list-notes-by-tag (tag-name) | 159 | (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) |
160 | (mapcar #'org-roam-node-file | 160 | (setq org-roam-capture-templates |
161 | (seq-filter | 161 | '(("a" "workstuff" plain (file (concat org-roam-directory "/work")) |
162 | (jd/org-roam-filter-by-tag tag-name) | 162 | :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org" |
163 | (org-roam-node-list)))) | 163 | "#+title: ${title}\n") |
164 | 164 | :unnarrowed t) | |
165 | (defun jd/org-roam-refreshagenda-list () | 165 | ("b" "research" plain (file "~/Documents/roam/study/templates/research.org") |
166 | (interactive) | 166 | :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org" |
167 | (setq org-agenda-files (org-roam-list-files))) | 167 | "#+title: ${title}\n") |
168 | 168 | :unnarrowed t) | |
169 | (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) | 169 | ("s" "School") |
170 | (setq org-roam-capture-templates | 170 | ("ss" "School General" plain nil |
171 | '(("a" "workstuff" plain (file (concat org-roam-directory "/work")) | 171 | :target (file+head |
172 | :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org" | 172 | "school/%<%Y%m%d%H%M%S>-${slug}.org" |
173 | "#+title: ${title}\n") | 173 | "#+title: ${title}\n") |
174 | :unnarrowed t) | 174 | :unnarrowed t) |
175 | ("b" "research" plain (file "~/Documents/roam/study/templates/research.org") | 175 | ("sp" "Polish Lesson" plain nil |
176 | :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org" | 176 | :target (file+head |
177 | "#+title: ${title}\n") | 177 | "school/polish/%<%Y%m%d%H%M%S>-${slug}.org" |
178 | :unnarrowed t) | 178 | "#+title: ${title}\n") |
179 | ("s" "School") | 179 | :unnarrowed t) |
180 | ("ss" "School General" plain nil | 180 | ("sw" "Wos Lesson" plain nil |
181 | :target (file+head | 181 | :target (file+head |
182 | "school/%<%Y%m%d%H%M%S>-${slug}.org" | 182 | "school/wos/%<%Y%m%d%H%M%S>-${slug}.org" |
183 | "#+title: ${title}\n") | 183 | "#+title: ${title}\n") |
184 | :unnarrowed t) | 184 | :unnarrowed t) |
185 | ("sp" "Polish Lesson" plain nil | 185 | ("g" "Guitar" plain nil |
186 | :target (file+head | 186 | :target (file+head |
187 | "school/polish/%<%Y%m%d%H%M%S>-${slug}.org" | 187 | "guitar/%<%Y%m%d%H%M%S>-${slug}.org" |
188 | "#+title: ${title}\n") | 188 | "#+title: ${title}\n") |
189 | :unnarrowed t) | 189 | :unnarrowed t) |
190 | ("sw" "Wos Lesson" plain nil | 190 | ("d" "default" plain nil |
191 | :target (file+head | 191 | :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" |
192 | "school/wos/%<%Y%m%d%H%M%S>-${slug}.org" | 192 | "#+title: ${title}\n") |
193 | "#+title: ${title}\n") | 193 | :unnarrowed t))) |
194 | :unnarrowed t) | 194 | |
195 | ("g" "Guitar" plain nil | 195 | (org-roam-db-autosync-mode)) |
196 | :target (file+head | 196 | |
197 | "guitar/%<%Y%m%d%H%M%S>-${slug}.org" | 197 | (use-package! ox-pandoc "emacs-ox-pandoc") |
198 | "#+title: ${title}\n") | ||
199 | :unnarrowed t) | ||
200 | ("d" "default" plain nil | ||
201 | :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" | ||
202 | "#+title: ${title}\n") | ||
203 | :unnarrowed t) | ||
204 | )) | ||
205 | |||
206 | (org-roam-db-autosync-mode)) | ||
207 | |||
208 | (jd/use-package ox-pandoc "emacs-ox-pandoc") | ||
209 | 198 | ||
210 | (provide 'jd-org) | 199 | (provide 'jd-org) |
211 | 200 | ||