Skip to content
Snippets Groups Projects
Commit dac8005c authored by Tim van Deurzen's avatar Tim van Deurzen
Browse files

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

parent 0b650016
No related branches found
No related tags found
No related merge requests found
......@@ -24,14 +24,35 @@
(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
(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
(setq org-directory "~/org/")
(setq org-todo-keywords
'((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
org-startup-folded 'fold
......@@ -40,9 +61,9 @@
org-time-clocksum-format (quote (:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
org-duration-format (quote h:mm)
org-agenda-format-date (lambda (date) (concat "\n"
(make-string (window-width) 9472)
"\n"
(org-agenda-format-date-aligned date)))
(make-string (window-width) 9472)
"\n"
(org-agenda-format-date-aligned date)))
org-log-done 'time
org-log-into-drawer t
......@@ -67,6 +88,7 @@
org-enforce-todo-dependencies t
org-enforce-todo-checkbox-dependencies t
alert-default-style 'libnotify
org-catch-invisible-edits 'show-and-error
org-refile-use-outline-path 'full-file-path
org-outline-path-complete-in-steps nil
......@@ -74,87 +96,120 @@
org-refile-targets '((nil :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/"
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 deft-directory "~/org/roam")
(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))
;(defun vulpea-agenda-files-update (&rest _)
; "Update the value of `org-agenda-files'."
; (setq org-agenda-files (vulpea-project-files)))
;
;(advice-add 'org-agenda :before #'vulpea-agenda-files-update)
(defun tim/capture-project ()
"Select or capture project within a particular workspace."
(add-hook! org-mode :append
#'visual-line-mode
#'org-appear-mode)
(interactive)
(let* ((workspace (completing-read "workspace: " (tim/org-roam-workspaces)))
(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)
"Return a lambda to select nodes with a particular tag TAG."
(lambda (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)))
(seq-filter (lambda (name)
(and (file-directory-p (concat org-roam-directory name))
(not (string-prefix-p "." name))))
(not (tim/hidden-file-p name))))
files)))
(defun tim/org-roam-find-project-workspace ()
(interactive)
(let* ((directory (completing-read "org-roam directory: " (ayrat555/org-roam-directories)))
(org-roam-directory (expand-file-name directory org-roam-directory)))
(org-roam-node-find
nil
nil
(tim/org-roam-filter-by-tag directory))
))
;; (defun tim/org-roam-find-project-workspace ()
;; (interactive)
;;
;; (let* ((directory (completing-read "workspace: " (ayrat555/org-roam-directories)))
;; (org-roam-directory (expand-file-name directory org-roam-directory)))
;; (org-roam-node-find
;; nil
;; nil
;; (tim/org-roam-filter-by-tag directory))
;; ))
(map! :leader
(:prefix-map ("n" . "notes")
(:prefix ("w" . "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
:after org-agenda
:hook (org-agenda-mode . org-super-agenda-mode)
:config
(setq org-agenda-custom-commands
'(("z" "Custom Day"
......@@ -191,10 +246,40 @@
(:name "Overdue"
: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 @@
(evil +everywhere) ; come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness
(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
......
......@@ -13,6 +13,12 @@
(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
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment