summaryrefslogtreecommitdiffstats
path: root/.config/emacs/jd-emacs/jd-emacs-org-mode.el
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2023-07-02 15:07:07 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2023-07-02 15:07:07 +0200
commit6156f86dd5797de5ea4f912b70d38963c6cf4ad4 (patch)
treed578204262209695d995e3f639076e91dcb85354 /.config/emacs/jd-emacs/jd-emacs-org-mode.el
parentef565a486511cbbb86e0d1f80264b3b57d2ac88a (diff)
downloaddotfiles-6156f86dd5797de5ea4f912b70d38963c6cf4ad4.tar.gz
dotfiles-6156f86dd5797de5ea4f912b70d38963c6cf4ad4.zip
New Emacs config and change location of Emacs home dir.
Diffstat (limited to '.config/emacs/jd-emacs/jd-emacs-org-mode.el')
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-org-mode.el200
1 files changed, 0 insertions, 200 deletions
diff --git a/.config/emacs/jd-emacs/jd-emacs-org-mode.el b/.config/emacs/jd-emacs/jd-emacs-org-mode.el
deleted file mode 100644
index 0e5ae42..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-org-mode.el
+++ /dev/null
@@ -1,200 +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-daily-home (concat jd/org-home "/roam/daily"))
9
10(defun jd/org-mode-init ()
11 (org-indent-mode)
12 (variable-pitch-mode 1)
13 (visual-line-mode 1))
14
15;; (defun jd-emacs/org-insert-date (&optional date)
16;; (let ((d (or date "+0d")))
17;; (org-insert-time-stamp (org-read-date nil t d)))) TODO
18
19
20(use-package org
21 :pin org
22 :commands (org-capture org-agenda)
23 :hook (org-mode . jd/org-mode-init)
24 :config
25 (setq org-directory (file-truename "~/Documents/Org/"))
26 (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org"))
27 (setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
28 (setq org-agenda-files
29 '("Tasks.org"))
30 (setq org-ellipsis " ▾")
31 (setq org-agenda-start-with-log-mode t)
32 (setq org-log-done 'time)
33 (setq org-log-into-drawer t)
34 (setq org-return-follows-link t)
35 (setq org-capture-templates
36 `(("t" "Tasks / Projects")
37 ("tt" "Task" entry (file+olp "Tasks.org" "Inbox")
38 "* TODO %?\n %t\n %a\n %i" :empty-lines 1)
39 ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox")
40 "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1)
41
42 ("m" "Metrics Capture")
43 ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics")
44 "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t)
45 ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org"))))
46
47 (setq org-latex-listings 'minted
48 org-latex-packages-alist '(("" "minted"))
49 org-latex-pdf-process
50 '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
51 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
52 (require 'org-tempo))
53(jd/leader-key-def
54 "o" '(:ignore t :which-key "Open/Org")
55 "oc" '(org-capture :which-key "Open org-capture")
56 "oop" '(org-mobile-pull :which-key "Org mobile pull")
57 "ooP" '(org-mobile-push :which-key "Org mobile push")
58 "oa" '(org-agenda :which-key "Open org-agenda"))
59
60(use-package evil-org
61 :after org
62 :hook (org-mode . (lambda () evil-org-mode))
63 :config
64 (require 'evil-org-agenda)
65 (evil-org-agenda-set-keys))
66
67(use-package toc-org
68 :config
69 (add-hook 'org-mode-hook 'toc-org-mode))
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 (add-to-list 'org-structure-template-alist '("s" . "src"))
111 (add-to-list 'org-structure-template-alist '("sql" . "src sql"))
112 (add-to-list 'org-structure-template-alist '("sh" . "src sh"))
113 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
114 (add-to-list 'org-structure-template-alist '("li" . "src lisp"))
115 (add-to-list 'org-structure-template-alist '("sc" . "src scheme"))
116 (add-to-list 'org-structure-template-alist '("ts" . "src typescript"))
117 (add-to-list 'org-structure-template-alist '("py" . "src python"))
118 (add-to-list 'org-structure-template-alist '("go" . "src go"))
119 (add-to-list 'org-structure-template-alist '("yaml" . "src yaml")))
120
121(with-eval-after-load 'org-tempo (jd/org-tempo-setup))
122
123(org-babel-do-load-languages
124 'org-babel-load-languages
125 '((emacs-lisp . t)
126 (python . t)))
127
128(defun jd/org-babel-tangle-config ()
129 (when (string-equal (file-name-directory (buffer-file-name))
130 (expand-file-name "~/dotfiles/"))
131 ;; Dynamic scoping to the rescue
132 (let ((org-confirm-babel-evaluate nil))
133 (org-babel-tangle))))
134
135(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config)))
136
137(defun jd/org-mode-visual-fill ()
138 (setq visual-fill-column-width 100
139 visual-fill-column-center-text t)
140 (visual-fill-column-mode 1))
141
142(use-package visual-fill-column
143 :hook (org-mode . jd/org-mode-visual-fill))
144
145(use-package org-superstar
146 :hook (org-mode . org-superstar-mode)
147 :init
148 (setq org-superstar-special-todo-items t)
149 (setq org-superstar-remove-leading-stars t)
150 (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●")))
151
152(defun jd/org-roam-filter-by-tag (tag-name)
153 (lambda (node)
154 (member tag-name (org-roam-node-tags node))))
155
156(defun jd/org-roam-list-notes-by-tag (tag-name)
157 (mapcar #'org-roam-node-file
158 (seq-filter
159 (jd/org-roam-filter-by-tag tag-name)
160 (org-roam-node-list))))
161
162(defun jd/org-roam-refreshagenda-list ()
163 (interactive)
164 (setq org-agenda-files (org-roam-list-files)))
165
166(use-package org-roam
167 :custom
168 (org-roam-directory (file-truename jd/org-roam-home))
169 :bind (("C-c n l" . org-roam-buffer-toggle)
170 ("C-c n f" . org-roam-node-find)
171 ("C-c n g" . org-roam-graph)
172 ("C-c n i" . org-roam-node-insert)
173 ("C-c n c" . org-roam-capture)
174 ;; Dailies
175 ("C-c n j" . org-roam-dailies-capture-today))
176 :bind-keymap
177 ("C-c n d" . org-roam-dailies-map)
178 :config
179 ;; If you're using a vertical completion framework, you might want a more informative completion interface
180 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
181 (setq org-roam-capture-templates
182 '(("a" "workstuff" plain (file (concat org-roam-directory "/work"))
183 :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org"
184 "#+title: ${title}\n") :unnarrowed t)
185 ("b" "research" plain (file "~/Documents/roam/study/templates/research.org")
186 :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org"
187 "#+title: ${title}\n") :unnarrowed t)
188 ("s" "School" plain nil
189 :target (file+head
190 "school/%<%Y%m%d%H%M%S>-${slug}.org"
191 "#+title: ${title}\n")
192 :unnarrowed t)
193 ("d" "default" plain nil
194 :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
195 "#+title: ${title}\n") :unnarrowed t)
196 ))
197
198 (org-roam-db-autosync-mode))
199
200;;; jd-emacs-org-mode.el ends here