doom: update org config a bit

This commit is contained in:
Jez Cope 2021-07-16 08:49:30 +01:00
parent 98298d525e
commit 45a3d8eebd
1 changed files with 83 additions and 39 deletions

View File

@ -96,36 +96,72 @@ The environment variable ~SSH_AUTH_SOCK~ needs to be set for git to work within
(?* . ?★)))
#+end_src
** Behaviour tweaks
#+begin_src emacs-lisp
(general-add-hook 'org-insert-heading-hook
'evil-insert-state
t) ;; append instead of prepending
#+end_src
** File locations
#+begin_src emacs-lisp
(setq jc/notes-dir (f-expand "~/Notes")
jc/logbook-file (f-expand "logbook.org" jc/notes-dir)
(after! org
(setq jc/notes-dir (f-expand "~/Notes")
jc/logbook-file (f-expand "logbook.org" jc/notes-dir)
org-directory jc/notes-dir
org-roam-directory (f-expand "Roam" jc/notes-dir)
org-roam-dailies-directory "daily/"
org-directory jc/notes-dir
org-roam-directory (f-expand "Roam" jc/notes-dir)
org-roam-dailies-directory "daily/"
jc/agenda-file-home (f-expand "Todo/todo-home.org" jc/notes-dir)
jc/agenda-file-work (f-expand "Todo/todo-work.org" jc/notes-dir)
jc/agenda-files-all (list jc/agenda-file-work jc/agenda-file-home)
org-agenda-files jc/agenda-files-all
jc/spark-file (f-expand "spark.org" org-roam-directory)
jc/agenda-file-home (f-expand "Todo/todo-home.org" jc/notes-dir)
jc/agenda-file-work (f-expand "Todo/todo-work.org" jc/notes-dir)
jc/agenda-files-all (list jc/agenda-file-work jc/agenda-file-home)
org-agenda-files jc/agenda-files-all
jc/spark-file (f-expand "spark.org" org-roam-directory)
org-archive-location "%s_archive::datetree/"
jc/agenda-file-home-archive (concat jc/agenda-file-home "_archive")
jc/agenda-file-work-archive (concat jc/agenda-file-work "_archive"))
jc/agenda-file-sets (cons jc/agenda-files-all (mapcar 'list jc/agenda-files-all))
org-archive-location "%s_archive::datetree/"
jc/agenda-file-home-archive (concat jc/agenda-file-home "_archive")
jc/agenda-file-work-archive (concat jc/agenda-file-work "_archive")))
(add-to-list 'auto-mode-alist '("\\.org_archive\\'" . org-mode))
#+end_src
*** File sets
#+begin_src emacs-lisp
(defvar jc/agenda-file-sets '() "List of agenda file sets")
(defun list-successor (x xs)
(if (null xs) nil
(let ((y (car xs))
(ys (cdr xs)))
(or (catch 'result
(while ys
(if (equal x y)
(throw 'result (car ys))
(setq y (car ys)
ys (cdr ys)))))
(car xs)))))
(defun jc/agenda-file-set-next ()
(interactive)
(let ((next-set (list-successor org-agenda-files jc/agenda-file-sets)))
(setq org-agenda-files next-set))
(message (format "Current agenda files: %s" org-agenda-files)))
#+end_src
** Refiling
#+begin_src emacs-lisp
(setq org-refile-targets `((,jc/agenda-files-all . (:maxlevel . 3))
(,jc/spark-file . (:maxlevel . 2))
(nil . (:maxlevel . 3)))
org-refile-use-outline-path nil)
(after! org
(setq org-refile-targets `((,jc/agenda-files-all . (:maxlevel . 3))
(,jc/spark-file . (:maxlevel . 2))
(nil . (:maxlevel . 3)))
org-refile-use-outline-path nil))
#+end_src
** Capture
@ -187,7 +223,12 @@ The environment variable ~SSH_AUTH_SOCK~ needs to be set for git to work within
** Todo
#+begin_src emacs-lisp
(setq org-enforce-todo-dependencies t
(setq org-todo-keywords
'((sequence "TODO(t)" "COOL(c)" "WARM(w)" "HOT(h)" "DOING(o!)" "|" "DONE(d!)" "DROPPED(x@)")
(sequence "WAITING(a@)" "DELEGATED(l@)" "DISCUSS(s)" "MONITOR(m)" "ONHOLD(H)" "|")
(sequence "TOREAD" "READING" "|" "READ"))
org-enforce-todo-dependencies t
org-agenda-dim-blocked-tasks t)
#+end_src
@ -309,25 +350,6 @@ See also [[id:18709859-c3db-4d0e-a4a0-e797b58a2e07][Capture templates]]
** Agenda
#+begin_src emacs-lisp :tangle no
(spacemacs/declare-prefix "ot" "Todo lists")
(spacemacs/declare-prefix "oc" "Capture")
(spacemacs/set-leader-keys
"occ" #'org-capture
"oct" #'org-roam-dailies-capture-today
"ocy" #'org-roam-dailies-capture-yesterday
"ocd" #'org-roam-dailies-capture-date
"ott" #'org-todo-list
"otw" (jc/org-todo-list-with-file-command jc/agenda-file-work)
"oth" (jc/org-todo-list-with-file-command jc/agenda-file-home)
"otq" #'org-ql-view
"otk" (jc/org-ql-view-command "Working: Kanban")
"otf" (jc/org-ql-view-command "Working: Focus")
"&" 'async-shell-command)
#+end_src
*** Super agenda
#+begin_src emacs-lisp
@ -366,7 +388,7 @@ See also [[id:18709859-c3db-4d0e-a4a0-e797b58a2e07][Capture templates]]
(:name "Blocked"
:and (:todo t :pred jc/agenda-line-blocked-p)
:order 8)
(:name "Doing (2)"
(:name "Doing (3)"
:todo "DOING")
(:name "Hot (3)"
:todo "HOT")
@ -421,7 +443,7 @@ See also [[id:18709859-c3db-4d0e-a4a0-e797b58a2e07][Capture templates]]
:title "Agendas"
:buffers-files org-agenda-files
:query (and (todo "DELEGATED" "WAITING" "DISCUSS")
(tags "BM" "RK" "TR"))
(tags "BlaM" "BluM" "RK"))
:super-groups ((:auto-tags t)))
("Process: Inbox"
:buffers-files ,(f-expand "Todo/inbox.org" jc/notes-dir))
@ -454,6 +476,8 @@ See also [[id:18709859-c3db-4d0e-a4a0-e797b58a2e07][Capture templates]]
(:name "Stalled"
:order 0
:anything t)))))
(map! :leader :desc "Org-ql views" :n "oq" #'org-ql-view)
#+end_src
* Reading
@ -580,3 +604,23 @@ You can also try ~gd~ (or ~C-c c d~) to jump to their definition and see how the
(let ((file (tramp-file-name-localname (tramp-dissect-file-name file))))
(replace-regexp-in-string (concat "\\`" dir) "" file))))
#+end_src
*** Former spacemacs key bindings (mostly for org agendas)
#+begin_src emacs-lisp :tangle no
(spacemacs/declare-prefix "ot" "Todo lists")
(spacemacs/declare-prefix "oc" "Capture")
(spacemacs/set-leader-keys
"occ" #'org-capture
"oct" #'org-roam-dailies-capture-today
"ocy" #'org-roam-dailies-capture-yesterday
"ocd" #'org-roam-dailies-capture-date
"ott" #'org-todo-list
"otw" (jc/org-todo-list-with-file-command jc/agenda-file-work)
"oth" (jc/org-todo-list-with-file-command jc/agenda-file-home)
"otq" #'org-ql-view
"otk" (jc/org-ql-view-command "Working: Kanban")
"otf" (jc/org-ql-view-command "Working: Focus")
"&" 'async-shell-command)
#+end_src