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