summary refs log tree commit diff
path: root/emacs.d/custom/fcuny-org.el
diff options
context:
space:
mode:
authorFranck Cuny <fcuny@twitter.com>2019-08-29 16:56:24 -0700
committerFranck Cuny <fcuny@twitter.com>2019-08-29 16:56:24 -0700
commit244ecae6d5e4780ccf22e9333061a4c45a843647 (patch)
tree721dbef723f1e51d48bb32c4fafdcfe785c2dbfe /emacs.d/custom/fcuny-org.el
parent[org] fix template to create tasks (diff)
downloademacs.d-244ecae6d5e4780ccf22e9333061a4c45a843647.tar.gz
[org] major rewrite of the config
i've used the workflow documented at
http://www.howardism.org/Technical/Emacs/getting-more-boxes-done.html
for the last few days and it's definitely better than anything i've
tried so far.

the rewrite is mostly to replicate the configuration (with some minor
adjustments).
Diffstat (limited to '')
-rw-r--r--emacs.d/custom/fcuny-org.el182
1 files changed, 110 insertions, 72 deletions
diff --git a/emacs.d/custom/fcuny-org.el b/emacs.d/custom/fcuny-org.el
index 0bdac7b..9f10720 100644
--- a/emacs.d/custom/fcuny-org.el
+++ b/emacs.d/custom/fcuny-org.el
@@ -1,13 +1,19 @@
 (require 'fcuny-vars)
 
+(use-package dash
+  :ensure t)
+
 (use-package org
+  :after (dash)
   :ensure t
 
-  :hook ((org-mode . visual-line-mode)
-         (org-mode . org-indent-mode))
+  :hook ((org-mode              . visual-line-mode)
+         (org-mode              . org-indent-mode)
+         (org-capture-mode-hook . delete-other-windows))
 
   :bind (("C-c c" . org-capture)
-         ("C-c a" . org-agenda))
+         ("C-c a" . org-agenda)
+         ("C-c o" . hydra-org-menu/body))
 
   :config
   (progn ()
@@ -18,32 +24,49 @@
        (emacs-lisp . t))))
 
   :custom
-  ;; priorities. I use:
-  ;; -1 important + urgent
-  ;; -2 important + non-urgent
-  ;; -3 non-important + urgent
-  ;; -4 non-important + non-urgent
-  (org-highest-priority ?1)
-  (org-default-priority ?4)
-  (org-lowest-priority ?4)
-
+  ;; cosmetic
   (org-pretty-entities t)
-  (org-src-fontify-natively t)
-  ;; prevent the conversion of spaces into tabs (necessary for Python code exports)
-  (org-src-preserve-indentation t)
-  (org-edit-src-content-indentation t)
-
   (org-startup-indented t)
+  (org-tags-column -120)
+
+  ;; files
   (org-directory (expand-file-name "~/Documents/notebooks"))
-  (org-default-inbox-file (concat org-directory "/gtd.org"))
-  (org-default-notes-file (concat org-directory "/gtd.org"))
+  (org-archive-dir (concat org-directory "/archive/"))
+
+  (org-default-projects-dir (concat org-directory "/projects"))
+  (org-default-personal-dir (concat org-directory "/personal"))
+  (org-default-completed-dir (concat org-directory "/completed"))
+  (org-default-technical-dir (concat org-directory "/technical"))
+
+  (org-default-completed-file nil)
+  (org-default-inbox-file (concat org-directory "/inbox.org"))
+  (org-default-tasks-file (concat org-directory "/tasks.org"))
+  (org-default-incubate-file (concat org-directory "/incubate.org"))
+  (org-default-media-file (concat org-directory "/media.org"))
+  (org-default-notes-file (concat org-directory "/notes.org"))
+
+  ;; how to manage tasks
+  (org-todo-keywords '((sequence "TODO(t)" "DOING(g)" "|" "DONE(d)")
+                       (sequence "|" "CANCELED(c)")))
+
+  ;; agenda related
   (org-agenda-start-on-weekday 1)
-  (org-tags-column -120)
+  (org-agenda-files `(,org-default-projects-dir
+                      ,org-default-inbox-file
+                      ,org-default-tasks-file))
+
+  ;; org babel related
+  ;; prevent the conversion of spaces into tabs (necessary for Python code exports)
+  (org-src-fontify-natively t)
+  (org-src-preserve-indentation t)
+  (org-edit-src-content-indentation t)
 
+  ;; behavior
   ;; I want to follow links on RET
   (org-return-follows-link t)
-  (org-blank-before-new-entry (quote ((heading . nil)
-				      (plain-list-item . nil))))
+  (org-enforce-todo-dependencies t)
+  (org-export-with-toc nil)
+  (org-export-with-section-numbers nil)
 
   ;; A few abbreviations I use regularly
   (org-link-abbrev-alist
@@ -52,62 +75,28 @@
      ("ph"   . "https://phabricator.twitter.biz/%s")
      ("go"   . "http://go/%s")))
 
-  ;; The sequence I want to use to navigate tasks
-  (org-todo-keywords
-   '((sequence "TODO(t)" "NEXT(n)" "STARTED(s)" "|" "DONE(d)" "CANCELED(c)")))
-
-  (org-enforce-todo-dependencies t)
-
-  ;; list of files to use for the agenda
-  (org-agenda-files (list (expand-file-name "tasks.org" org-directory)
-                          (expand-file-name "projects.org" org-directory)
-                          (expand-file-name "tw-journal.org" org-directory)))
-
-  (org-export-with-toc nil)
-  (org-export-with-section-numbers nil)
+  ;; entries
+  (org-blank-before-new-entry (quote ((heading . nil)
+				      (plain-list-item . nil))))
 
   ;; see https://github.com/abo-abo/swiper/issues/986
   (org-goto-interface 'outline-path-completion)
-  (org-outline-path-complete-in-steps nil)
+
+  ;; refile and capture
   (org-refile-use-outline-path 'file)
+  (org-outline-path-complete-in-steps nil)
   (org-refile-allow-creating-parent-nodes 'confirm)
-  (org-refile-targets '((org-agenda-files :maxlevel . 4)))
-
-  ;; for the agenda, I want to see tasks in order of priorities.
-  (org-agenda-custom-commands
-   '(("c" "Agenda by priorities"
-      ((tags-todo "PRIORITY=\"1\""
-                  ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
-                   (org-agenda-overriding-header "important and urgent:")))
-       (tags-todo "PRIORITY=\"2\""
-                  ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
-                   (org-agenda-overriding-header "important and non-urgent:")))
-       (tags-todo "PRIORITY=\"3\""
-                  ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
-                   (org-agenda-overriding-header "non-important and urgent:")))
-       (agenda "" ((org-agenda-ndays 1)))
-       (alltodo "" ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)))))
-      ((org-agenda-compact-blocks t)))))
+  (org-refile-targets (append '((org-default-media-file :level . 1)
+                                (org-default-notes-file :level . 0))
+                              (->>
+                               (directory-files org-default-projects-dir nil ".org$")
+                               (-remove-item (file-name-base org-default-media-file))
+                               (--remove (s-starts-with? "." it))
+                               (--map (format "%s/%s" org-default-projects-dir it))
+                               (--map (cons it (cons :level 1))))))
 
   (org-capture-templates
-   `(;; templates for general references, links, etc. They can be relevant for both work and personal learning.
-     ("r" "Reference" entry
-      (file ,(concat org-directory "/kb.org") "Reference")
-      "* %^{TITLE} %^G\n:PROPERTIES:\n:Created: %U\n:END:\n%?")
-     ("e" "Event" entry
-      (file+headline ,(concat org-directory "/notes.org") "Event")
-      "* %^{EVENT}\n:PROPERTIES:\n:Created: %U\n:Location: %^{prompt}\n:END:\n%?")
-     ("b" "Bookmark" entry
-      (file+headline ,(concat org-directory "/notes.org") "Bookmark")
-      "* %(fcuny/get-page-title (current-kill 0)) %^g\n:PROPERTIES:\n:Created: %U\n:ReadLater: %^{read later|Yes|No}\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00|5:00}\n:END:\n%?")
-     ("q" "Quotes" entry
-      (file+headline ,(concat org-directory "/notes.org") "Quote")
-      "* %^{TITLE}\n:PROPERTIES:\n:Created: %U\n:Page: %^{page}\n:END:\n%?")
-     ("d" "Debug" entry
-      (file ,(concat org-directory "/debug.org") "Debug")
-      "* %^{TITLE}\n:PROPERTIES:\n:Created: %U\n:END:\n%?")
-
-     ;; templates for personal things only.
+   `(;; templates for personal things only.
      ("j" "Personal Journal" entry
       (file+olp+datetree ,(concat org-directory "/journal.org"))
       "* %U %?\n"
@@ -133,9 +122,58 @@
 
      ("t" "task entry" entry
       (file ,org-default-inbox-file )
-      "* TODO [#4] %? %^G\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n%i\n\nfrom: %a"))))
+      "* %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n%i\n\nfrom: %a")))
+
+  :config
+  (defhydra hydra-org-menu (:columns 6)
+     "
+  ^Navigate^      ^Refile^       ^Move^           ^Update^        ^Go To^        ^Dired^
+  ^^^^^^^^^^---------------------------------------------------------------------------------------
+  _k_: ↑ previous _t_: tasks     _m X_: projects  _T_: todo task  _g t_: tasks    _g X_: projects
+  _j_: ↓ next     _p_: personal  _m P_: personal  _S_: schedule   _g x_: inbox    _g P_: personal
+  _c_: archive    _r_: refile    _m T_: technical _D_: deadline   _g n_: notes    _g T_: technical
+  _d_: delete     _i_: incubate                 _R_: rename                   _g C_: completed
+  "
+    ("<up>" org-previous-visible-heading)
+    ("<down>" org-next-visible-heading)
+    ("k" org-previous-visible-heading)
+    ("j" org-next-visible-heading)
+    ("c" fcuny/org-archive-subtree-as-completed)
+    ("d" org-cut-subtree)
+    ("t" fcuny/org-refile-to-task)
+    ("i" fcuny/org-refile-to-incubate)
+    ("p" fcuny/org-refile-to-personal-notes)
+    ("r" org-refile)
+    ("m X" fcuny/org-refile-to-projects-dir)
+    ("m P" fcuny/org-refile-to-personal-dir)
+    ("m T" fcuny/org-refile-to-technical-dir)
+    ("T" org-todo)
+    ("S" org-schedule)
+    ("D" org-deadline)
+    ("R" org-rename-header)
+    ("g t" (find-file-other-window org-default-tasks-file))
+    ("g i" (find-file-other-window org-default-incubate-file))
+    ("g x" (find-file-other-window org-default-inbox-file))
+    ("g c" (find-file-other-window org-default-completed-file))
+    ("g n" (find-file-other-window org-default-notes-file))
+    ("g X" (dired org-default-projects-dir))
+    ("g P" (dired org-default-personal-dir))
+    ("g T" (dired org-default-technical-dir))
+    ("g C" (dired org-default-completed-dir))
+    ("[\t]" (org-cycle))
+    ("s" (org-save-all-org-buffers) "save")
+    ("q" nil "quit")))
 
 (use-package htmlize
   :ensure t)
 
+(use-package org-journal
+  :ensure t
+  :after (org)
+  :custom
+  (org-journal-file-format "%Y-%m.org")
+  (org-journal-dir "~/Documents/notebooks/journal/")
+  (org-journal-date-format "#+TITLE: Monthly Journal Entry - %e %b %Y (%A)")
+  (org-journal-file-type `monthly))
+
 (provide 'fcuny-org)