Redo org configuration
This commit is contained in:
parent
76d6da531e
commit
1a0d29a743
1 changed files with 27 additions and 285 deletions
|
@ -58,38 +58,25 @@
|
|||
(after! org
|
||||
(add-to-list 'org-modules 'org-habit)
|
||||
(setq-default org-directory "~/code/personal/org")
|
||||
(setq-default org-default-notes-file "~/code/personal/org/capture.org")
|
||||
(setq-default org-default-notes-file "~/code/personal/org/inbox.org")
|
||||
(setq-default org-todo-keywords
|
||||
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
|
||||
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING"))))
|
||||
(quote ((sequence "TODO(t)" "DONE(d)" "WAITING(w@/!)"))))
|
||||
(setq-default org-todo-keyword-faces
|
||||
(quote (("TODO" :foreground "tomato" :weight bold)
|
||||
("NEXT" :foreground "royal blue" :weight bold)
|
||||
("DONE" :foreground "forest green" :weight bold)
|
||||
("WAITING" :foreground "chocolate" :weight bold)
|
||||
("HOLD" :foreground "orchid" :weight bold)
|
||||
("CANCELLED" :foreground "yellow" :weight bold)
|
||||
("MEETING" :foreground "gold" :weight bold)
|
||||
("PHONE" :foreground "orange" :weight bold))))
|
||||
("WAITING" :foreground "chocolate" :weight bold))))
|
||||
(setq org-capture-templates
|
||||
(quote (("t" "todo" entry (file "~/code/personal/org/capture.org")
|
||||
(quote (("t" "todo" entry (file "~/code/personal/org/inbox.org")
|
||||
"* TODO %?\n%U\n" :clock-in t :clock-resume t)
|
||||
("r" "respond" entry (file "~/code/personal/org/capture.org")
|
||||
"* STRT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
|
||||
("n" "note" entry (file "~/code/personal/org/capture.org")
|
||||
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
|
||||
("w" "org-protocol" entry (file "~/code/personal/org/capture.org")
|
||||
"* TODO Review %c\n%U\n" :immediate-finish t)
|
||||
("m" "meeting" entry (file "~/code/personal/org/capture.org")
|
||||
"* PROJ Meeting with %? :MEETING:\n%U" :clock-in t :clock-resume t))))
|
||||
(setq org-refile-targets (quote ((nil :maxlevel . 9)
|
||||
(org-agenda-files :maxlevel . 9))))
|
||||
("n" "note" entry (file "~/code/personal/org/inbox.org")
|
||||
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t))))
|
||||
(setq org-refile-targets '((nil :maxlevel . 9)
|
||||
(org-agenda-files :maxlevel . 9)))
|
||||
(add-to-list
|
||||
'ivy-completing-read-handlers-alist
|
||||
'(org-capture-refile . completing-read-default))
|
||||
(org-clock-persistence-insinuate)
|
||||
(setq org-clock-in-switch-to-state 'cf/clock-in-to-next)
|
||||
(setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
|
||||
(setq org-clock-into-drawer t)
|
||||
(setq org-clock-out-remove-zero-time-clocks t)
|
||||
(setq org-clock-out-when-done t)
|
||||
|
@ -99,85 +86,33 @@
|
|||
(setq org-agenda-dim-blocked-tasks nil)
|
||||
(setq org-agenda-compact-blocks t)
|
||||
(setq org-agenda-custom-commands
|
||||
(quote (("N" "Notes" tags "NOTE"
|
||||
((org-agenda-overriding-header "Notes")
|
||||
(org-tags-match-list-sublevels t)))
|
||||
(" " "Agenda"
|
||||
((agenda "" nil)
|
||||
(tags "REFILE"
|
||||
((org-agenda-overriding-header "Tasks to Refile")
|
||||
(org-tags-match-list-sublevels nil)))
|
||||
(tags-todo "-CANCELLED/!"
|
||||
((org-agenda-overriding-header "Stuck Projects")
|
||||
(org-agenda-skip-function 'cf/skip-non-stuck-projects)
|
||||
(org-agenda-sorting-strategy
|
||||
'(category-keep))))
|
||||
(tags-todo "-HOLD-CANCELLED/!"
|
||||
((org-agenda-overriding-header "Projects")
|
||||
(org-agenda-skip-function 'cf/skip-non-projects)
|
||||
(org-tags-match-list-sublevels 'indented)
|
||||
(org-agenda-sorting-strategy
|
||||
'(category-keep))))
|
||||
(tags-todo "-CANCELLED/!NEXT"
|
||||
((org-agenda-overriding-header (concat "Project Next Tasks"
|
||||
(if cf/hide-scheduled-and-waiting-next-tasks
|
||||
""
|
||||
" (including WAITING and SCHEDULED tasks)")))
|
||||
(org-agenda-skip-function 'cf/skip-projects-and-habits-and-single-tasks)
|
||||
(org-tags-match-list-sublevels t)
|
||||
(org-agenda-todo-ignore-scheduled cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-deadlines cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-with-date cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-sorting-strategy
|
||||
'(todo-state-down effort-up category-keep))))
|
||||
(tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
|
||||
((org-agenda-overriding-header (concat "Project Subtasks"
|
||||
(if cf/hide-scheduled-and-waiting-next-tasks
|
||||
""
|
||||
" (including WAITING and SCHEDULED tasks)")))
|
||||
(org-agenda-skip-function 'cf/skip-non-project-tasks)
|
||||
(org-agenda-todo-ignore-scheduled cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-deadlines cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-with-date cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-sorting-strategy
|
||||
'(category-keep))))
|
||||
(tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
|
||||
((org-agenda-overriding-header (concat "Standalone Tasks"
|
||||
(if cf/hide-scheduled-and-waiting-next-tasks
|
||||
""
|
||||
" (including WAITING and SCHEDULED tasks)")))
|
||||
(org-agenda-skip-function 'cf/skip-project-tasks)
|
||||
(org-agenda-todo-ignore-scheduled cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-deadlines cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-with-date cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-sorting-strategy
|
||||
'(category-keep))))
|
||||
(tags-todo "-CANCELLED+WAITING|HOLD/!"
|
||||
((org-agenda-overriding-header (concat "Waiting and Postponed Tasks"
|
||||
(if cf/hide-scheduled-and-waiting-next-tasks
|
||||
""
|
||||
" (including WAITING and SCHEDULED tasks)")))
|
||||
(org-agenda-skip-function 'cf/skip-non-tasks)
|
||||
(org-tags-match-list-sublevels nil)
|
||||
(org-agenda-todo-ignore-scheduled cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-deadlines cf/hide-scheduled-and-waiting-next-tasks)))
|
||||
(tags "-REFILE/"
|
||||
((org-agenda-overriding-header "Tasks to Archive")
|
||||
(org-agenda-skip-function 'cf/skip-non-archivable-tasks)
|
||||
(org-tags-match-list-sublevels nil))))
|
||||
nil)))))
|
||||
(quote ((" " "Agenda"
|
||||
((agenda "" nil)
|
||||
(tags "REFILE"
|
||||
((org-agenda-overriding-header "Tasks to Refile")
|
||||
(org-tags-match-list-sublevels nil)))
|
||||
(tags-todo "-CANCELLED+WAITING|HOLD/!"
|
||||
((org-agenda-overriding-header (concat "Waiting Tasks"))
|
||||
(org-agenda-skip-function 'cf/skip-non-tasks)
|
||||
(org-tags-match-list-sublevels nil)
|
||||
(org-agenda-todo-ignore-scheduled cf/hide-scheduled-and-waiting-next-tasks)
|
||||
(org-agenda-todo-ignore-deadlines cf/hide-scheduled-and-waiting-next-tasks)))
|
||||
(tags "-REFILE/"
|
||||
((org-agenda-overriding-header "Tasks to Archive")
|
||||
(org-agenda-skip-function 'cf/skip-non-archivable-tasks)
|
||||
(org-tags-match-list-sublevels nil))))
|
||||
nil)))))
|
||||
|
||||
|
||||
(map! :map global-map :leader "a" 'org-agenda)
|
||||
|
||||
(defvar cf/hide-scheduled-and-waiting-next-tasks t)
|
||||
|
||||
(defun cf/clock-in-to-next (kw)
|
||||
(when (not (and (boundp 'org-capture-mode) org-capture-mode))
|
||||
(cond
|
||||
((and (member (org-get-todo-state) (list "TODO"))
|
||||
((and (member (org-get-todo-state) (list "WAITING"))
|
||||
(cf/is-task-p))
|
||||
"NEXT")
|
||||
((and (member (org-get-todo-state) (list "NEXT"))
|
||||
(cf/is-project-p))
|
||||
"TODO"))))
|
||||
|
||||
(defun cf/find-project-task ()
|
||||
|
@ -220,97 +155,6 @@
|
|||
(setq has-subtask t))))
|
||||
(and is-a-task (not has-subtask)))))
|
||||
|
||||
(defun cf/is-project-subtree-p ()
|
||||
(let ((task (save-excursion (org-back-to-heading 'invisible-ok)
|
||||
(point))))
|
||||
(save-excursion
|
||||
(cf/find-project-task)
|
||||
(if (equal (point) task)
|
||||
nil
|
||||
t))))
|
||||
|
||||
(defun cf/is-subproject-p ()
|
||||
(let ((is-subproject)
|
||||
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
|
||||
(save-excursion
|
||||
(while (and (not is-subproject) (org-up-heading-safe))
|
||||
(when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
|
||||
(setq is-subproject t))))
|
||||
(and is-a-task is-subproject)))
|
||||
|
||||
(defun cf/list-sublevels-for-projects-indented ()
|
||||
(if (marker-buffer org-agenda-restrict-begin)
|
||||
(setq org-tags-match-list-sublevels 'indented)
|
||||
(setq org-tags-match-list-sublevels nil))
|
||||
nil)
|
||||
|
||||
(defun cf/list-sublevels-for-projects ()
|
||||
(if (marker-buffer org-agenda-restrict-begin)
|
||||
(setq org-tags-match-list-sublevels t)
|
||||
(setq org-tags-match-list-sublevels nil))
|
||||
nil)
|
||||
|
||||
(defvar cf/hide-scheduled-and-waiting-next-tasks t)
|
||||
|
||||
|
||||
(defun cf/toggle-next-task-display ()
|
||||
(interactive)
|
||||
(setq cf/hide-scheduled-and-waiting-next-tasks (not cf/hide-scheduled-and-waiting-next-tasks))
|
||||
(when (equal major-mode 'org-agenda-mode)
|
||||
(org-agenda-redo))
|
||||
(message "%s WAITING and SCHEDULED NEXT Tasks" (if cf/hide-scheduled-and-waiting-next-tasks "Hide" "Show")))
|
||||
|
||||
|
||||
(defun cf/skip-stuck-projects ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
|
||||
(if (cf/is-project-p)
|
||||
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
|
||||
(has-next ))
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(while (and (not has-next) (< (point) subtree-end) (re-search-forward "^\\*+ NEXT " subtree-end t))
|
||||
(unless (member "WAITING" (org-get-tags-at))
|
||||
(setq has-next t))))
|
||||
(if has-next
|
||||
nil
|
||||
next-headline)) ; a stuck project, has subtasks but no next task
|
||||
nil))))
|
||||
|
||||
(defun cf/skip-non-stuck-projects ()
|
||||
;; (cf/list-sublevels-for-projects-indented)
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
|
||||
(if (cf/is-project-p)
|
||||
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
|
||||
(has-next ))
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(while (and (not has-next) (< (point) subtree-end) (re-search-forward "^\\*+ NEXT " subtree-end t))
|
||||
(unless (member "WAITING" (org-get-tags-at))
|
||||
(setq has-next t))))
|
||||
(if has-next
|
||||
next-headline
|
||||
nil)) ; a stuck project, has subtasks but no next task
|
||||
next-headline))))
|
||||
|
||||
(defun cf/skip-non-projects ()
|
||||
;; (cf/list-sublevels-for-projects-indented)
|
||||
(if (save-excursion (cf/skip-non-stuck-projects))
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
|
||||
(cond
|
||||
((cf/is-project-p)
|
||||
nil)
|
||||
((and (cf/is-project-subtree-p) (not (cf/is-task-p)))
|
||||
nil)
|
||||
(t
|
||||
subtree-end))))
|
||||
(save-excursion (org-end-of-subtree t))))
|
||||
|
||||
(defun cf/skip-non-tasks ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
|
@ -321,108 +165,6 @@
|
|||
(t
|
||||
next-headline)))))
|
||||
|
||||
(defun cf/skip-project-trees-and-habits ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
|
||||
(cond
|
||||
((cf/is-project-p)
|
||||
subtree-end)
|
||||
((org-is-habit-p)
|
||||
subtree-end)
|
||||
(t
|
||||
nil)))))
|
||||
|
||||
(defun cf/skip-projects-and-habits-and-single-tasks ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
|
||||
(cond
|
||||
((org-is-habit-p)
|
||||
next-headline)
|
||||
((and cf/hide-scheduled-and-waiting-next-tasks
|
||||
(member "WAITING" (org-get-tags-at)))
|
||||
next-headline)
|
||||
((cf/is-project-p)
|
||||
next-headline)
|
||||
((and (cf/is-task-p) (not (cf/is-project-subtree-p)))
|
||||
next-headline)
|
||||
(t
|
||||
nil)))))
|
||||
|
||||
(defun cf/skip-project-tasks-maybe ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
|
||||
(next-headline (save-excursion (or (outline-next-heading) (point-max))))
|
||||
(limit-to-project (marker-buffer org-agenda-restrict-begin)))
|
||||
(cond
|
||||
((cf/is-project-p)
|
||||
next-headline)
|
||||
((org-is-habit-p)
|
||||
subtree-end)
|
||||
((and (not limit-to-project)
|
||||
(cf/is-project-subtree-p))
|
||||
subtree-end)
|
||||
((and limit-to-project
|
||||
(cf/is-project-subtree-p)
|
||||
(member (org-get-todo-state) (list "NEXT")))
|
||||
subtree-end)
|
||||
(t
|
||||
nil)))))
|
||||
|
||||
(defun cf/skip-project-tasks ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let* ((subtree-end (save-excursion (org-end-of-subtree t))))
|
||||
(cond
|
||||
((cf/is-project-p)
|
||||
subtree-end)
|
||||
((org-is-habit-p)
|
||||
subtree-end)
|
||||
((cf/is-project-subtree-p)
|
||||
subtree-end)
|
||||
(t
|
||||
nil)))))
|
||||
|
||||
|
||||
(defun cf/skip-non-project-tasks ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
|
||||
(next-headline (save-excursion (or (outline-next-heading) (point-max)))))
|
||||
(cond
|
||||
((cf/is-project-p)
|
||||
next-headline)
|
||||
((org-is-habit-p)
|
||||
subtree-end)
|
||||
((and (cf/is-project-subtree-p)
|
||||
(member (org-get-todo-state) (list "NEXT")))
|
||||
subtree-end)
|
||||
((not (cf/is-project-subtree-p))
|
||||
subtree-end)
|
||||
(t
|
||||
nil)))))
|
||||
|
||||
|
||||
(defun cf/skip-projects-and-habits ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
|
||||
(cond
|
||||
((cf/is-project-p)
|
||||
subtree-end)
|
||||
((org-is-habit-p)
|
||||
subtree-end)
|
||||
(t
|
||||
nil)))))
|
||||
|
||||
(defun cf/skip-non-subprojects ()
|
||||
(let ((next-headline (save-excursion (outline-next-heading))))
|
||||
(if (cf/is-subproject-p)
|
||||
nil
|
||||
next-headline)))
|
||||
|
||||
(defun cf/skip-non-archivable-tasks ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
|
|
Loading…
Add table
Reference in a new issue