diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2024-09-20 14:16:56 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2024-09-20 14:16:56 +0200 |
commit | 45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a (patch) | |
tree | b564c1c43920def6641cd482a7b4dca453dbc043 /files/.emacs.d/jd/jd-org.el | |
parent | 07dd8e37eb767c3dd6abf63e5e4a720cd778da15 (diff) | |
download | dotfiles-45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a.tar.gz dotfiles-45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a.zip |
Change dotfiles structure, and add guix-channels declaration.
Diffstat (limited to 'files/.emacs.d/jd/jd-org.el')
-rwxr-xr-x | files/.emacs.d/jd/jd-org.el | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/files/.emacs.d/jd/jd-org.el b/files/.emacs.d/jd/jd-org.el new file mode 100755 index 0000000..400d00c --- /dev/null +++ b/files/.emacs.d/jd/jd-org.el | |||
@@ -0,0 +1,224 @@ | |||
1 | ;;; Dotfiles --- Jakub Dlugosz emacs config | ||
2 | ;;; Commentary: | ||
3 | |||
4 | ;;; Code: | ||
5 | |||
6 | (defvar jd/org-home "~/Notes") | ||
7 | (defvar jd/org-roam-home (concat jd/org-home "/roam")) | ||
8 | (defvar jd/org-sync (concat jd/org-home "/sync")) | ||
9 | (defvar jd/org-roam-daily-home (concat jd/org-roam-home "/daily")) | ||
10 | |||
11 | (defun jd/org-mode-init () | ||
12 | (org-indent-mode) | ||
13 | (variable-pitch-mode 1) | ||
14 | (visual-line-mode 1)) | ||
15 | |||
16 | (defun jd-emacs/org-insert-date (&optional date) | ||
17 | (org-insert-time-stamp (org-read-date nil t (or date "+0d")))) | ||
18 | |||
19 | (use-package org-pomodoro | ||
20 | :guix-package "emacs-org-pomodoro") | ||
21 | |||
22 | (use-package org-caldav | ||
23 | :guix-package "emacs-org-caldav" | ||
24 | :config | ||
25 | (setq org-caldav-url "http://caldav.jdlugosz.com/radicale/admin/" | ||
26 | org-caldav-files nil | ||
27 | org-icalendar-timezone "Europe/Warsaw") | ||
28 | |||
29 | (defun jd/caldav-calendar-sync () | ||
30 | (interactive) | ||
31 | (let ((org-caldav-calendar-id "0c54a523-c7aa-2f26-2c18-a12b69c2bc86") | ||
32 | (org-caldav-inbox (concat jd/org-sync | ||
33 | "/calendar.org"))) | ||
34 | (org-caldav-sync))) | ||
35 | |||
36 | (defun jd/caldav-journal-sync () | ||
37 | (interactive) | ||
38 | (let ((org-caldav-calendar-id "3cc70419-a787-5f84-28c6-96f15fc606d9") | ||
39 | (org-caldav-inbox (concat jd/org-sync | ||
40 | "/journal.org"))) | ||
41 | (org-caldav-sync))) | ||
42 | |||
43 | (defun jd/caldav-tasks-sync () | ||
44 | (interactive) | ||
45 | (let ((org-caldav-calendar-id "372cbbb3-14f7-fc15-9f7b-cae04114920c") | ||
46 | (org-caldav-inbox (concat jd/org-sync | ||
47 | "/tasks.org"))) | ||
48 | (org-caldav-sync)))) | ||
49 | |||
50 | (use-package org | ||
51 | :guix-package "emacs-org" | ||
52 | :pin org | ||
53 | :commands (org-capture org-agenda) | ||
54 | :hook (org-mode . jd/org-mode-init) | ||
55 | :bind | ||
56 | ("C-c o c" . #'org-capture) | ||
57 | ("C-c o p" . #'org-mobile-pull) | ||
58 | ("C-c o P" . #'org-mobile-push) | ||
59 | ("C-c o a" . #'org-agenda) | ||
60 | :config | ||
61 | (defun jd/org-mode-file (file-name) (concat org-directory "/" file-name ".org")) | ||
62 | (setq org-directory (file-truename "~/Notes") | ||
63 | org-mobile-directory (concat org-directory "/Mobile") | ||
64 | org-mobile-inbox-for-pull (concat org-directory "/flagged.org") ;; TODO: ?? | ||
65 | |||
66 | org-refile-targets '((org-agenda-files :maxlevel . 1)) | ||
67 | org-outline-path-complete-in-steps nil | ||
68 | org-refile-use-outline-path t | ||
69 | org-agenda-files '("Personal.org" "Work.org" "Inbox.org") | ||
70 | org-ellipsis " ▾" | ||
71 | org-agenda-start-with-log-mode t | ||
72 | org-log-done 'time | ||
73 | org-log-into-drawer t | ||
74 | org-return-follows-link t | ||
75 | org-latex-listings 'minted | ||
76 | org-latex-packages-alist '(("" "minted")) | ||
77 | |||
78 | org-agenda-custom-commands | ||
79 | `(("p" "Planning" | ||
80 | ((tags-todo "+planning" | ||
81 | ((org-agenda-overriding-header "Planning Tasks"))) | ||
82 | (tags-todo "-{.*}" | ||
83 | ((org-agenda-overriding-header "Untagged Tasks"))) | ||
84 | (todo "*" ((org-agenda-files '(,(jd/org-mode-file "Inbox"))) | ||
85 | (org-agenda-overriding-header "Unprocessed Inbox Items"))))) | ||
86 | |||
87 | ("d" "Daily Agenda" | ||
88 | ((agenda "" ((org-agenda-span 'day) | ||
89 | (org-deadline-warning-days 7))) | ||
90 | (tags-todo "+PRIORITY=\"A\"" | ||
91 | ((org-agenda-overriding-header "High Priority Tasks"))))) | ||
92 | |||
93 | ("w" "Weekly Review" | ||
94 | ((agenda "" | ||
95 | ((org-agenda-overriding-header "Completed Tasks") | ||
96 | (org-agenda-skip-function '(org-agenda-skip-entry-if 'nottodo 'done)) | ||
97 | (org-agenda-span 'week))) | ||
98 | |||
99 | (agenda "" | ||
100 | ((org-agenda-overriding-header "Unfinished Scheduled Tasks") | ||
101 | (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) | ||
102 | (org-agenda-span 'week)))))) | ||
103 | |||
104 | org-capture-templates | ||
105 | `(("i" "Capture to Inbox" entry (file+olp ,(jd/org-mode-file "Inbox") "Inbox") | ||
106 | "* TODO %?\n %t\n" :empty-lines 1)) | ||
107 | |||
108 | org-latex-pdf-process | ||
109 | '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" | ||
110 | "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) | ||
111 | |||
112 | (require 'org-tempo) | ||
113 | |||
114 | (defun jd/org-font-setup () | ||
115 | ;; Replace list hyphen with dot | ||
116 | ;; (font-lock-add-keywords 'org-mode | ||
117 | ;; '(("^ *\\([.]\\) " | ||
118 | ;; (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) | ||
119 | |||
120 | ;; Set faces for heading levels | ||
121 | (dolist (face '((org-level-1 . 1.3) | ||
122 | (org-level-2 . 1.2) | ||
123 | (org-level-3 . 1.1) | ||
124 | (org-level-4 . 1.0) | ||
125 | (org-level-5 . 1.0) | ||
126 | (org-level-6 . 1.0) | ||
127 | (org-level-7 . 1.0) | ||
128 | (org-level-8 . 1.0))) | ||
129 | (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face))) | ||
130 | |||
131 | ;; Ensure that anything that should be fixed-pitch in Org files appears that way | ||
132 | (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100) | ||
133 | (set-face-attribute 'org-table nil :inherit 'fixed-pitch) | ||
134 | (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) | ||
135 | (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) | ||
136 | (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) | ||
137 | (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
138 | (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) | ||
139 | (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) | ||
140 | (set-face-attribute 'line-number nil :inherit 'fixed-pitch) | ||
141 | (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) | ||
142 | |||
143 | (with-eval-after-load 'org (jd/org-font-setup)) | ||
144 | |||
145 | (defun jd-emacs/org-timer-stop () | ||
146 | (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie")) | ||
147 | |||
148 | (add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop) | ||
149 | |||
150 | (defun jd/org-tempo-setup () | ||
151 | (dolist (template '(("s" . "src") | ||
152 | ("sql" . "src sql") | ||
153 | ("sh" . "src sh") | ||
154 | ("el" . "src emacs-lisp") | ||
155 | ("li" . "src lisp") | ||
156 | ("sc" . "src scheme") | ||
157 | ("ts" . "src typescript") | ||
158 | ("py" . "src python") | ||
159 | ("go" . "src go") | ||
160 | ("yaml" . "src yaml"))) | ||
161 | (add-to-list 'org-structure-template-alist template))) | ||
162 | |||
163 | (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) | ||
164 | |||
165 | (org-babel-do-load-languages | ||
166 | 'org-babel-load-languages | ||
167 | '((emacs-lisp . t) | ||
168 | (python . t) | ||
169 | (shell . t)))) | ||
170 | |||
171 | (use-package org-superstar | ||
172 | :guix-package "emacs-org-superstar" | ||
173 | :hook (org-mode . org-superstar-mode) | ||
174 | :init | ||
175 | (setq org-superstar-special-todo-items t) | ||
176 | (setq org-superstar-remove-leading-stars t) | ||
177 | (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) | ||
178 | |||
179 | (use-package org-roam | ||
180 | :guix-package "emacs-org-roam" | ||
181 | :custom | ||
182 | (org-roam-directory (file-truename jd/org-roam-home)) | ||
183 | :bind (("C-c n l" . org-roam-buffer-toggle) | ||
184 | ("C-c n f" . org-roam-node-find) | ||
185 | ("C-c n g" . org-roam-graph) | ||
186 | ("C-c n i" . org-roam-node-insert) | ||
187 | ("C-c n c" . org-roam-capture) | ||
188 | ;; Dailies | ||
189 | ("C-c n j" . org-roam-dailies-capture-today)) | ||
190 | :bind-keymap | ||
191 | ("C-c n d" . org-roam-dailies-map) | ||
192 | :config | ||
193 | (require 'org-roam-dailies) | ||
194 | |||
195 | (defun jd/org-roam-filter-by-tag (tag-name) | ||
196 | (lambda (node) | ||
197 | (member tag-name (org-roam-node-tags node)))) | ||
198 | |||
199 | (defun jd/org-roam-list-notes-by-tag (tag-name) | ||
200 | (mapcar #'org-roam-node-file | ||
201 | (seq-filter | ||
202 | (jd/org-roam-filter-by-tag tag-name) | ||
203 | (org-roam-node-list)))) | ||
204 | |||
205 | (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) | ||
206 | (setq org-roam-capture-templates | ||
207 | '(("d" "default" plain "%?" | ||
208 | :target (file+head | ||
209 | "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n\n* ${title}\n %?") ;; TODO: point cursor to the end of the file, it should be: `%?` | ||
210 | :unnarrowed t) | ||
211 | ;; ("n" "insert node" plain (file "~/Documents/roam/study/templates/research.org") | ||
212 | ;; :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org" | ||
213 | ;; "#+title: ${title}\n") | ||
214 | ;; :unnarrowed t) | ||
215 | )) | ||
216 | |||
217 | (org-roam-db-autosync-mode)) | ||
218 | |||
219 | (use-package ox-pandoc | ||
220 | :guix-package "emacs-ox-pandoc") | ||
221 | |||
222 | (provide 'jd-org) | ||
223 | |||
224 | ;;; jd-org.el ends here | ||