blob: eabee00ecf68e8a456b6a49563d58abdc5545fc2 (
plain) (
blame)
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
155
156
157
158
159
160
161
162
163
164
|
;;; init-notes.el --- for notes and tasks -*- lexical-binding: t -*-
;; Author: Franck Cuny <franck@fcuny.net>
;;; Commentary:
;; commentary
;;; Code:
(use-package denote
:ensure t
:hook (dired-mode . denote-dired-mode)
:init
(use-package denote-org-extras
:ensure nil)
(use-package denote-journal-extras
:ensure nil)
:bind (("C-c n r" . denote-rename-file)
("C-c n t" . denote-journal-extras-new-or-existing-entry)
("C-c n n" . denote-subdirectory)
("C-c n c" . denote))
:custom
(denote-known-keywords '("journal" "project" "TIL" "people" "interviews"))
(denote-rename-buffer-mode 1)
(denote-journal-extras-directory (concat denote-directory "journal/" (format-time-string "%Y")))
(denote-file-type "org")
(denote-org-capture-specifiers "%i\n%?")
(denote-dired-directories (list denote-directory))
(denote-dired-directories-include-subdirectories t)
(denote-journal-extras-title-format 'day-date-month-year))
(use-package consult-denote
:after consult
:ensure t
:bind (("C-c n f" . consult-denote-find)
("C-c n g" . consult-denote-grep))
:config
(consult-denote-mode 1)
;; Prefer `ripgrep' and `fd' variants when available
(when (executable-find "fd")
(setopt consult-denote-find-command #'consult-fd))
(when (executable-find "rg")
(setopt consult-denote-grep-command #'consult-ripgrep)))
(use-package org
:hook
(org-mode . turn-on-flyspell)
(org-mode . visual-line-mode)
(org-mode . org-indent-mode)
:preface
(defun my/org-entry-get-immediate (property)
(save-excursion
(let ((local (org--property-local-values property nil)))
(and local (mapconcat #'identity
(delq nil local)
(org--property-get-separator property))))))
(defun org-refile-heading-p ()
(let ((todo-state (org-get-todo-state)))
(if todo-state
(string= todo-state "PROJECT")
(my/org-entry-get-immediate "CATEGORY"))))
:custom
(org-directory "~/Documents/notes")
(org-default-notes-file (expand-file-name "tasks.org" org-directory))
(org-agenda-files '("tasks.org" "inbox.org"))
(org-startup-folded t)
(org-startup-indented t)
(org-startup-with-inline-images t)
;; enable todo and checkbox dependencies
(org-enforce-todo-dependencies t)
(org-enforce-todo-checkbox-dependencies t)
;; quick access for todo states
(org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "WAITING(w!)" "|" "DONE(d)")
(sequence "PROJECT(p@/!)" "|" "COMPLETE(d@/!)" "ABORTED(x@/!)")
(sequence "|" "CANCELLED(c)")))
(org-log-done 'time)
(org-log-into-drawer t)
;; org-refile options
(org-refile-target-verify-function 'org-refile-heading-p)
(org-refile-targets
'((org-agenda-files :maxlevel . 4)))
(org-refile-allow-creating-parent-nodes (quote confirm))
(org-hide-emphasis-markers t)
(org-hide-leading-stars t)
(org-pretty-entities t)
(org-return-follows-link t)
(org-export-backends '(html md))
(org-imenu-depth 4)
(org-insert-heading-respect-content t)
(org-outline-path-complete-in-steps nil)
(org-src-fontify-natively t)
(org-src-preserve-indentation t)
(org-src-tab-acts-natively t)
(org-src-window-setup 'current-window)
(org-yank-adjusted-subtrees t)
(org-structure-template-alist
'(("s" . "src")
("E" . "src emacs-lisp")
("p" . "src python")
("e" . "example")
("q" . "quote"))))
(use-package org-capture
:ensure nil
:after org
:bind
("C-c c" . org-capture)
:config
(setq org-capture-templates
`(("t" "Tasks" entry (file "inbox.org")
"* TODO %?\n%U" :prepend t :empty-lines 0)
("n" "note" plain (file denote-last-path) #'denote-org-capture
:no-save t :immediate-finish nil :kill-buffer t :jump-to-captured nil))))
(use-package org-agenda
:ensure nil
:after org
:bind
("C-c a" . org-agenda)
:custom
(org-agenda-hide-tags-regexp (regexp-opt '("project")))
(org-agenda-start-on-weekday 1))
(use-package org-auto-tangle
:ensure t
:hook (org-mode . org-auto-tangle-mode))
(use-package org-babel
:no-require t
:after (org)
:config
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)
(emacs-lisp . t)
(calc . t)
(shell . t)
(sql . t)
(dot . t)))
(remove-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory)
(advice-add 'org-babel-edit-prep:emacs-lisp :after
#'(lambda (_info) (run-hooks 'emacs-lisp-mode-hook))))
(provide 'init-notes)
;;; init-notes.el ends here
|