From d0106421352d9d32c1991f504f36442c9e4605e4 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sat, 1 Jan 2022 09:04:25 -0500 Subject: emacs config --- emacs/.doom.d/config.el | 70 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) (limited to 'emacs') diff --git a/emacs/.doom.d/config.el b/emacs/.doom.d/config.el index f2396bf..da5fbbd 100644 --- a/emacs/.doom.d/config.el +++ b/emacs/.doom.d/config.el @@ -84,6 +84,31 @@ (defvar kj/publish-tag "publish") (defvar kj/publish-directory "/ssh:orbekk@dragon.orbekk.com:/storage/srv/kj.orbekk.com") +(setq org-log-done 'time) +(setq org-todo-keywords + '((sequence + "TODO(t)" ; A task that needs doing & is ready to do + "PROJ(p)" ; A project, which usually contains other tasks + "LOOP(r)" ; A recurring task + "STRT(s)" ; A task that is in progress + "WAIT(w)" ; Something external is holding up this task + "HOLD(h)" ; This task is paused/on hold because of me + "IDEA(i)" ; An unconfirmed and unapproved task or notion + "|" + "DONE(d!)" ; Task successfully completed + "KILL(k)") ; Task was cancelled, aborted or is no longer applicable + (sequence + "[ ](T)" ; A task that needs doing + "[-](S)" ; Task is in progress + "[?](W)" ; Task is being held up or paused + "|" + "[X](D)") ; Task was completed + (sequence + "|" + "OKAY(o)" + "YES(y)" + "NO(n)"))) + (setq org-journal-file-type 'weekly) (setq org-journal-dir org-roam-directory) (setq org-journal-file-format "journal-%Y-%m-%d.org") @@ -151,25 +176,62 @@ (:output-dir . "static/data/")) org-babel-default-header-args)) - (setq org-agenda-archives-mode nil) + (defun kj/org-journal-find-location () + ;; Open today's journal, but specify a non-nil prefix argument in order to + ;; inhibit inserting the heading; org-capture will insert the heading. + (org-journal-new-entry t)) + ;; (unless (eq org-journal-file-type 'daily) + ;; (org-narrow-to-subtree)) + ;; (goto-char (point-max))) + + (defun kj/org-journal-narrowed-location () + ;; Open today's journal, but specify a non-nil prefix argument in order to + ;; inhibit inserting the heading; org-capture will insert the heading. + (org-journal-new-entry t) + (unless (eq org-journal-file-type 'daily) + (org-narrow-to-subtree)) + (goto-char (point-max))) + + (setq org-capture-templates + `(("g" "Go to current journal entry" plain (function kj/org-journal-find-location) + "%i%?" :jump-to-captured t :immediate-finish t) + ("t" "Create a TODO in current journal entry" plain (function kj/org-journal-narrowed-location) + "** TODO %?\n%i\n%a"))) + (defun kj/find-agenda-files-containing-tag (tag) + (setq org-agenda-archives-mode nil) (let* ((org-agenda-archives-mode nil) (candidates (org-agenda-files nil 'ifmode)) (matcher (cdr (org-make-tags-matcher tag))) (files)) - (message "Results:") + ;; (message "Results:") (dolist (file candidates files) (org-check-agenda-file file) (with-current-buffer (org-get-agenda-file-buffer file) - (message "%S" (org-scan-tags 'agenda matcher nil)) - + ;; (message "%S" (org-scan-tags 'agenda matcher nil)) (when (org-scan-tags 'agenda matcher nil) (push file files)))))) + (setq kj/inbox-path "/ssh:dragon.orbekk.com:/storage/srv/kj.orbekk.com/dav/Inbox.org") + + (defun kj/fetch-inbox () + (interactive) + (let ((content (with-current-buffer (find-file-noselect kj/inbox-path) + (buffer-string)))) + (kj/org-journal-find-location) + (when (not (string-empty-p content)) + (insert "** TODO Inbox items") + (org-insert-subheading 1) + (org-paste-subtree nil content))) + (with-current-buffer (find-file-noselect kj/inbox-path) + (erase-buffer) + (save-buffer))) + (defun kj/org-publish (&optional project force) (interactive) (setq project (or project "all")) (setq force (or force current-prefix-arg)) + (setq org-agenda-files (list org-roam-directory)) (let* ((static-files-re (string-join '("css" "txt" "jpg" "png" "gif" "svg") "\\|")) (files-to-include (kj/find-agenda-files-containing-tag kj/publish-tag)) ;; Disable org babel exports during publish entirely to speed up publish. -- cgit v1.2.3