summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-02-12 09:28:32 -0800
committerFranck Cuny <franck@fcuny.net>2021-02-12 09:28:32 -0800
commit2ea0ab96e38ab5869febe1864c3c2f587bed633f (patch)
tree0c57863f5b2a41475c34637d81d5ff697a599a6f /emacs
parentorg: custom functions (diff)
downloademacs.d-2ea0ab96e38ab5869febe1864c3c2f587bed633f.tar.gz
org: rewrite the capture templates
Start using `doct` to manage the configuration for capturing content.
Try to simplify a bit.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/custom/fcuny-org.el114
1 files changed, 77 insertions, 37 deletions
diff --git a/emacs/custom/fcuny-org.el b/emacs/custom/fcuny-org.el
index 92e0e65..dded47a 100644
--- a/emacs/custom/fcuny-org.el
+++ b/emacs/custom/fcuny-org.el
@@ -1,5 +1,28 @@
+(require 'fcuny-org-custom)
+
+(use-package org-ml
+  :ensure t)
+
+(use-package doct
+  :ensure t)
+
 (require 'fcuny-vars)
 
+(defvar fcuny/org-directory
+  (expand-file-name "~/workspace/notebooks"))
+
+(defvar fcuny/org-inbox-file
+  (concat fcuny/org-directory "/inbox.org"))
+
+(defvar fcuny/org-references-file
+  (concat fcuny/org-directory "/references.org"))
+
+(defvar fcuny/org-personal-notes-file
+  (concat fcuny/org-directory "/personal.org"))
+
+(defvar fcuny/org-work-notes-file
+  (concat fcuny/org-directory "/twitter.org"))
+
 (use-package htmlize
   :ensure t)
 
@@ -11,6 +34,7 @@
          (org-mode                     . visual-line-mode)
          (org-capture-after-finalize   . org-save-all-org-buffers)
          (org-capture-prepare-finalize . org-save-all-org-buffers))
+
   :bind (("C-c c" . org-capture)
          ("C-c a" . org-agenda))
 
@@ -26,17 +50,7 @@
                                load-language-list)
 
   :custom
-  (org-id-locations-file (concat fcuny/path-emacs-var "/org-id-locations"))
-
-  (org-directory (expand-file-name "~/Documents/Notebooks"))
-  (org-default-inbox-file (concat org-directory "/inbox.org"))
-  (org-default-notes-file (concat org-directory "/notes.org"))
-  (org-default-habit-file (concat org-directory "/habits.org"))
-  (org-default-tasks-file (concat org-directory "/personal-tasks.org"))
-  (org-default-work-tasks-file (concat org-directory "/work-tasks.org"))
-  (org-default-journal-file (concat org-directory "/personal-journal.org"))
-  (org-default-work-journal-file (concat org-directory "/work-journal.org"))
-  (org-default-interview-file (concat org-directory "/interviews.org"))
+  (org-directory fcuny/org-directory)
 
   ;; when archiving, inherit the tags from the parent
   (org-archive-subtree-add-inherited-tags t)
@@ -47,17 +61,26 @@
   ;; log the time of completion
   (org-log-done 'time)
 
+  (org-startup-indented t)
+
   ;; priorities
   (org-priority-start-cycle-with-default nil) ;; Start one over/under default value.
-  (org-lowest-priority ?F)
-  (org-default-priority ?D) ;; Ensures unset tasks have low priority.
+  (org-highest-priority ?1)
+  (org-lowest-priority ?4)
+  (org-default-priority ?3) ;; Ensures unset tasks have low priority.
 
   ;; agenda related
   (calendar-week-start-day 1)      ;; org-mode uses calendar for the date picker, and I want this to start on Monday
   (org-agenda-start-on-weekday 1)  ;; this is specific to org-agenda
-  (org-agenda-files `(,org-default-tasks-file
-                      ,org-default-work-tasks-file
-                      ,org-default-habit-file))
+  (org-agenda-files `(,fcuny/org-personal-notes-file
+                      ,fcuny/org-work-notes-file))
+
+  ;; refile
+  (org-refile-use-cache nil)
+  (org-refile-targets '((org-agenda-files . (:maxlevel . 6))))
+  (org-refile-use-outline-path 'file)
+  (org-outline-path-complete-in-steps nil)
+  (org-refile-allow-creating-parent-nodes 'confirm)
 
   ;; org babel related
   ;; prevent the conversion of spaces into tabs (necessary for Python code exports)
@@ -82,32 +105,49 @@
   ;; entries
   (org-blank-before-new-entry nil)
   (org-blank-before-new-entry (quote ((heading . nil)
-				      (plain-list-item . nil))))
+				                      (plain-list-item . nil))))
 
   ;; see https://github.com/abo-abo/swiper/issues/986
   (org-goto-interface 'outline-path-completion)
 
-  (org-reverse-note-order t)
+  (org-reverse-note-order t))
 
+(use-package org-capture
+  :ensure nil
+  :after (org doct)
+  :custom
   (org-capture-templates
-   `(("t" "Todo [inbox]" entry
-      (file+headline ,org-default-inbox-file "Tasks")
-      "* TODO [#D] %?\n:PROPERTIES:\n:ID: %(shell-command-to-string \"uuidgen\"):CREATED: %U\n:END:\n")
-
-     ("n" "Note" entry
-      (file ,org-default-notes-file)
-      "* NOTE %?\n:PROPERTIES:\n:ID: %(shell-command-to-string \"uuidgen\"):CREATED: %U\n:END:\n")
-
-     ("j" "Journal" entry
-      (file+olp+datetree ,org-default-journal-file)
-      "* %?\n:PROPERTIES:\n:ID: %(shell-command-to-string \"uuidgen\"):CREATED: %U\n:END:\n" :tree-type month)
-
-     ("i" "Interview notes" entry
-      (file+olp+datetree ,org-default-interview-file)
-      (file ,(concat fcuny/path-emacs-etc "/interview.org")))
-
-     ("J" "Work Journal" entry
-      (file+olp+datetree ,org-default-work-journal-file)
-      "* %?\n:PROPERTIES:\n:ID: %(shell-command-to-string \"uuidgen\"):CREATED: %U\n:END:\n" :tree-type month))))
+   (doct `(:group
+           :children
+           (("Personal" :keys "p" :file fcuny/org-personal-notes-file :clock-in t :clock-resume t :children
+             (("Task" :keys "t" :todo-state "TODO" :headline "Tasks"
+               :template ("* %{todo-state} [#3] %^{Description}"
+                          ":PROPERTIES:" ":CREATED: %U" ":END:"
+                          "%?"))
+              ("Note" :keys "n" :headline "Notes" :type entry
+               :template ("* %^{Description}"
+                          ":PROPERTIES:" ":CREATED: %U" ":END:"
+                          "%?"))
+              ("Reading" :keys "r" :todo-state "TODO" :headline "Reading"
+               :template ("* %{todo-state} %^{Description}"
+                          ":PROPERTIES:" ":CREATED: %U" ":END:"
+                          "%a"))
+              ("Journal" :keys "j" :type entry :datetree t :tree-type week
+               :template ("* %^{Description}"
+                          ":PROPERTIES:" ":CREATED: %U" ":END:"
+                          "%?"))))
+            ("Work" :keys "w" :file fcuny/org-work-notes-file :clock-in t :clock-resume t :children
+             (("Tasks" :keys "t" :todo-state "TODO" :headline "Tasks"
+               :template ("* %{todo-state} [#3] %^{Description}"
+                          ":PROPERTIES:" ":CREATED: %U" ":END:"
+                          "%?"))
+              ("Note" :keys "n" :headline "Notes" :type entry
+               :template ("* %^{Description}"
+                          ":PROPERTIES:" ":CREATED: %U" ":END:"
+                          "%?"))
+              ("Meeting" :keys "m" :type entry :datetree t :tree-type week
+               :template ("* meeting: %^{Description}"
+                          ":PROPERTIES:" ":CREATED: %U" ":END:"
+                          "%?")))))))))
 
 (provide 'fcuny-org)