Commit dac8005c authored by Tim van Deurzen's avatar Tim van Deurzen

Extensive updates to Doom emacs conf with new workflow mostly done.

parent 0b650016
...@@ -24,14 +24,35 @@ ...@@ -24,14 +24,35 @@
(after! evil (global-evil-colemak-basics-mode t)) (after! evil (global-evil-colemak-basics-mode t))
(setq default-frame-alist
(append (list
'(right-divider-width . 1)
'(bottom-divider-width . 1)
'(vertical-scroll-bars . nil)
'(internal-border-width . 15)
'(left-fringe . 4)
'(right-fringe . 4)
'(tool-bar-lines . 0)
'(menu-bar-lines . 0)
'(buffer-predicate . doom-buffer-frame-predicate))))
;;; ORG ;;; ORG
(use-package! org-appear
:after org
:hook (org-mode . org-appear-mode)
:config
(setq org-appear-autolinks t
org-appear-autoentities t
org-appear-autosubmarkers t))
(after! org (after! org
(setq org-directory "~/org/") (setq org-directory "~/org/")
(setq org-todo-keywords (setq org-todo-keywords
'((sequence "TODO(t)" "NEXT(n!)" "|" "DONE(d!)") '((sequence "TODO(t)" "NEXT(n!)" "|" "DONE(d!)")
(sequence "WAITING(w@/!)" "MAYBE(m)" "SOMEDAY(s)" "|" "CANCELED(c@)"))) (sequence "WAITING(w@/!)" "SOMEDAY(s)" "|" "CANCELED(c@)")))
(setq org-hide-emphasis-markers t (setq org-hide-emphasis-markers t
org-startup-folded 'fold org-startup-folded 'fold
...@@ -67,6 +88,7 @@ ...@@ -67,6 +88,7 @@
org-enforce-todo-dependencies t org-enforce-todo-dependencies t
org-enforce-todo-checkbox-dependencies t org-enforce-todo-checkbox-dependencies t
alert-default-style 'libnotify alert-default-style 'libnotify
org-catch-invisible-edits 'show-and-error
org-refile-use-outline-path 'full-file-path org-refile-use-outline-path 'full-file-path
org-outline-path-complete-in-steps nil org-outline-path-complete-in-steps nil
...@@ -74,87 +96,120 @@ ...@@ -74,87 +96,120 @@
org-refile-targets '((nil :maxlevel . 3) org-refile-targets '((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3)) (org-agenda-files :maxlevel . 3))
org-id-track-globally t) org-id-track-globally t))
(add-hook! org-mode :append
#'visual-line-mode
#'org-appear-mode)
(use-package! vulpea
:hook ((org-roam-db-autosync-mode . vulpea-db-autosync-mode)))
(use-package! org-transclusion
:after org-roam)
(after! org-roam
(setq org-roam-directory "~/org/roam/" (setq org-roam-directory "~/org/roam/"
org-roam-v2-ack t) org-roam-v2-ack t)
(setq org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%<Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t
)))
;; (setq org-roam-dailies-capture-templates) ;; (setq org-roam-dailies-capture-templates)
(setq deft-directory "~/org/roam") (setq deft-directory "~/org/roam")
(setq deft-extensions '("org")) (setq deft-extensions '("org"))
;; (setq org-noter-default-notes-file-names '("notes.org"))
;; (setq org-noter-notes-search-path '("~/org/roam/noter/" "~/org/roam"))
;;
;; (setq org-roam-server-host "127.0.0.1"
;; org-roam-server-port 9090
;; org-roam-server-authenticate nil
;; org-roam-server-export-inline-images t
;; org-roam-server-serve-files nil
;; org-roam-server-served-file-extensions '("pdf")
;; org-roam-server-network-poll t
;; org-roam-server-network-arrows nil
;; org-roam-server-network-label-truncate t
;; org-roam-server-network-label-truncate-length 60
;; org-roam-server-network-label-wrap-length 20)
;;
;; ;; (setq-default auto-fill-function 'do-auto-fill)
;;
;; (setq org-gcal-client-id "363943479757-e67275ue1tshm2ihnq4pbbp71i17u560.apps.googleusercontent.com"
;; org-gcal-client-secret "6AQ7_vtvqLTeL-ltDcwrIvao"
;; org-gcal-file-alist '(("tim.vandeurzen@gmail.com" . "~/org/agendas/google.org")))
(org-roam-db-autosync-mode)) (org-roam-db-autosync-mode))
;(defun vulpea-agenda-files-update (&rest _) (defun tim/capture-project ()
; "Update the value of `org-agenda-files'." "Select or capture project within a particular workspace."
; (setq org-agenda-files (vulpea-project-files)))
;
;(advice-add 'org-agenda :before #'vulpea-agenda-files-update)
(add-hook! org-mode :append (interactive)
#'visual-line-mode (let* ((workspace (completing-read "workspace: " (tim/org-roam-workspaces)))
#'org-appear-mode) (workspace-path (expand-file-name workspace org-roam-directory))
(template-path (format "%s/templates/" workspace-path))
(node-path-format (concat workspace-path "/%<%Y%m%d%H%M%S>-${slug}.org")))
(org-roam-capture- :node (org-roam-node-read nil (tim/org-roam-filter-by-tag workspace))
:templates
`(
("p" "project" plain (file ,(concat template-path "project.org"))
:if-new (file+head
,node-path-format
"#+title: ${title}")
:unnarrowed t)
("m" "monthly report" plain (file ,(concat template-path "monthly-report.org"))
:if-new (file+head
,(concat workspace-path "/%<%Y-%m>-report.org")
"#+title: %<%B %Y> report")
:unnarrowed t)
))))
;; TODO Create something similar to vulpea-find by first querying for the node and running org-roam-capture- if nothing is found.
(defun tim/capture-report ()
"Select or capture a (monthly) report within a particular workspace."
(interactive)
(let* ((workspace (completing-read "workspace: " (tim/org-roam-workspaces)))
(workspace-path (expand-file-name workspace org-roam-directory))
(org-roam-directory (expand-file-name workspace org-roam-directory))
(template-path (format "%s/templates/" workspace-path)))
(org-roam-capture- :node (org-roam-node-visit (or (org-roam-node-from-id (vulpea-note-id (vulpea-select-from "report" (vulpea-db-query-by-tags-every (list "report"))))) (org-roam-node-create)))
:templates
`(
("m" "monthly report" plain (file ,(concat template-path "monthly-report.org"))
:if-new (file+head "%<%Y-%B>.org" "#+title: %<%B %Y>")
:unnarrowed t)
))))
;; TODO Use vulpea-select-from to find the right node, extended with the workspace, and open it if the filter matches.
(require 'vulpea-select)
(vulpea-select-from "report" (vulpea-db-query-by-tags-every (list "report")))
(vulpea-db-qu)
(defun tim/org-roam-filter-by-tag (tag) (defun tim/org-roam-filter-by-tag (tag)
"Return a lambda to select nodes with a particular tag TAG."
(lambda (node) (lambda (node)
(member tag (org-roam-node-tags node)))) (member tag (org-roam-node-tags node))))
(defun ayrat555/org-roam-directories () (defun tim/hidden-file-p (name)
"Return whether the file with name NAME is hidden."
(string-prefix-p "." name))
(defun tim/org-roam-workspaces ()
"Use subfolders in the org-roam-directory ask workspaces for particular projects."
(let ((files (directory-files org-roam-directory))) (let ((files (directory-files org-roam-directory)))
(seq-filter (lambda (name) (seq-filter (lambda (name)
(and (file-directory-p (concat org-roam-directory name)) (and (file-directory-p (concat org-roam-directory name))
(not (string-prefix-p "." name)))) (not (tim/hidden-file-p name))))
files))) files)))
(defun tim/org-roam-find-project-workspace () ;; (defun tim/org-roam-find-project-workspace ()
(interactive) ;; (interactive)
;;
(let* ((directory (completing-read "org-roam directory: " (ayrat555/org-roam-directories))) ;; (let* ((directory (completing-read "workspace: " (ayrat555/org-roam-directories)))
(org-roam-directory (expand-file-name directory org-roam-directory))) ;; (org-roam-directory (expand-file-name directory org-roam-directory)))
(org-roam-node-find ;; (org-roam-node-find
nil ;; nil
nil ;; nil
(tim/org-roam-filter-by-tag directory)) ;; (tim/org-roam-filter-by-tag directory))
)) ;; ))
(map! :leader (map! :leader
(:prefix-map ("n" . "notes") (:prefix-map ("n" . "notes")
(:prefix ("w" . "workspace") (:prefix ("w" . "workspace")
:desc "New project in a workspace" "n" #'tim/org-roam-find-project-workspace))) :desc "New project in a workspace" "n" #'tim/org-roam-find-project-workspace)))
;; TODO Define custom key maps to load a specific agenda view that only contains relevant files.
;; TODO Redefine the default agenda to use a static set of files?
(use-package! org-super-agenda (use-package! org-super-agenda
:after org-agenda :after org-agenda
:hook (org-agenda-mode . org-super-agenda-mode)
:config :config
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
'(("z" "Custom Day" '(("z" "Custom Day"
...@@ -191,10 +246,40 @@ ...@@ -191,10 +246,40 @@
(:name "Overdue" (:name "Overdue"
:deadline past) :deadline past)
)))))) ))))))
)) )))
(org-super-agenda-mode))
(define-derived-mode project-explore-mode tabulated-list-mode "project-explore-mode"
"Major mode to explore projects."
(setq tabulated-list-format [("Title" 20 t)
("Summary" 60 nil)
("Date" 11 t)
("Tags" 10 nil)])
(setq tabulated-list-padding 2)
(setq tabulated-list-sort-key (cons "Date" t))
(use-local-map project-explore-mode-map)
(tabulated-list-init-header))
(defun tim/my-projects ()
"List all projects."
(mapcar
(lambda (node) (list
(org-roam-node-id node)
(vector
(org-roam-node-title node)
(org-roam-node-file node)
"date"
(org-roam-node-tags node))))
(seq-filter (tim/org-roam-filter-by-tag "bux") (org-roam-node-list))))
(defun explore-projects ()
(interactive)
(pop-to-buffer "*Project Explore Mode*" nil)
(project-explore-mode)
(setq tabulated-list-entries (tim/my-projects))
(tabulated-list-print t))
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
(evil +everywhere) ; come to the dark side, we have cookies (evil +everywhere) ; come to the dark side, we have cookies
file-templates ; auto-snippets for empty files file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness (format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys ;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim ;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once ;;multiple-cursors ; editing in many places at once
......
...@@ -13,6 +13,12 @@ ...@@ -13,6 +13,12 @@
(package! org-super-agenda) (package! org-super-agenda)
(package! vulpea)
(package! org-transclusion)
(package! org-appear)
;; To install a package directly from a remote git repo, you must specify a ;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here: ;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format ;; https://github.com/raxod502/straight.el#the-recipe-format
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment