diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-09-01T22·36-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-09-01T23·06+0000 |
commit | 2f7b688389058b454ee12adc4b6b47740298f53b (patch) | |
tree | b36c1f1aa6851f8e1160b05d6bd52190a0c21650 /users/glittershark | |
parent | c4136447b37b8c9e7397855594da53ff6fb99162 (diff) |
feat(gs/emacs): Generate org agenda commands from project tags r/1759
Auto-generate org agenda commands from project tags of the form `project__foo_bar`, prefixed with `p` and named based on the first letters of the words in the project. there is (obviously) some overlap here but that can be fixed by just adding extra underscores to things to disambiguate. Change-Id: If07b15a21d8bcb6df6245e8c6e4731041930ecc1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1926 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'users/glittershark')
-rw-r--r-- | users/glittershark/emacs.d/org-config.el | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/users/glittershark/emacs.d/org-config.el b/users/glittershark/emacs.d/org-config.el index f0a2bfaa65de..8d1b762edd50 100644 --- a/users/glittershark/emacs.d/org-config.el +++ b/users/glittershark/emacs.d/org-config.el @@ -4,6 +4,36 @@ (defun notes-file (f) (concat org-directory (if (string-prefix-p "/" f) "" "/") f)) +(defun grfn/org-project-tag->key (tag) + (s-replace-regexp "^project__" "" tag)) + +(defun grfn/org-project-tag->name (tag) + (s-titleized-words + (s-join " " (s-split "_" (grfn/org-project-tag->key tag))))) + +(defun grfn/org-project-tag->keys (tag) + (s-join "" (cons "p" + (-map (lambda (s) (substring-no-properties s 0 1)) + (s-split "_" (grfn/org-project-tag->key tag)))))) + +(defun grfn/org-projects->agenda-commands (project-tags) + (loop for tag in project-tags + collect `(,(grfn/org-project-tag->keys tag) + ,(grfn/org-project-tag->name tag) + tags-todo + ,tag))) + +(defun grfn/org-projects () + (loop for (tag) in + (org-global-tags-completion-table + (directory-files-recursively "~/notes" "\\.org$")) + when (s-starts-with-p "project__" tag) + collect tag)) + +(comment + (grfn/org-projects->agenda-commands (grfn/org-projects)) + ) + (setq org-directory (expand-file-name "~/notes") +org-dir (expand-file-name "~/notes") @@ -78,12 +108,15 @@ org-todo-keywords '((sequence "TODO(t)" "ACTIVE(a)" "|" "DONE(d)" "RUNNING(r)") (sequence "NEXT(n)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)")) org-agenda-custom-commands - '(("p" "Sprint Tasks" tags-todo "sprint") + `(("S" "Sprint Tasks" tags-todo "sprint") ("i" "Inbox" tags "inbox") ("r" "Running jobs" todo "RUNNING") ("w" "@Work" tags-todo "@work") ("n" . "Next...") - ("np" "Next Sprint" tags-todo "next_sprint|sprint_planning")) + ("np" "Next Sprint" tags-todo "next_sprint|sprint_planning") + + ("p" . "Project...") + ,@(grfn/org-projects->agenda-commands (grfn/org-projects))) org-agenda-dim-blocked-tasks nil org-enforce-todo-dependencies nil |