[oni-org] Experiment with using more contexts to filter tasks
Instead of adding a lot of tags and adding a lot of agendas filtering on them I'm experimenting with using org-edna to make certain contexts a dependency of a task to filter them out of my todo list. Current contexts I'm experimenting with are: - ‘day-of-week?’ to filter out tasks that I can only do on certain days. - ‘night-time?’ to filter out anything that I can't do in the evening. Usually having to do with contacting others. - ‘business-hours?’ to filter out anything that is outside of a certain timezone's “business hours”, defined by me as anywhere between 9am and 6pm.
This commit is contained in:
parent
c76c236991
commit
348f71e570
1 changed files with 22 additions and 11 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2023.0409.214302
|
;; Version: 2023.0411.202312
|
||||||
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti form-feed org-pretty-table)
|
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti form-feed org-pretty-table)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -600,16 +600,7 @@ also move point to the start of the heading."
|
||||||
(setq org-agenda-dim-blocked-tasks 'invisible)
|
(setq org-agenda-dim-blocked-tasks 'invisible)
|
||||||
|
|
||||||
(setq org-agenda-custom-commands
|
(setq org-agenda-custom-commands
|
||||||
`(("t" . "Things to do")
|
`(("t" "Todo" tags-todo "TODO=\"TODO\"-CATEGORY=\"project\"+(SCHEDULED<\"<tomorrow>\"|TODO=\"TODO\"-CATEGORY=\"project\"+SCHEDULED=\"\")")
|
||||||
("tt" "Todo at this computer" tags-todo ,(format "@%s|@computer|@emacs/TODO" (system-name))
|
|
||||||
((org-overriding-columns-format "%TODO %46ITEM %1BLOCKED %Effort")))
|
|
||||||
("tf" "Fun things to do" tags-todo "+fun")
|
|
||||||
;; ("r" "Reading list" tags-todo "TODO=\"READ\"+SCHEDULED=\"\"-Effort=\"\""
|
|
||||||
;; ((org-overriding-columns-format "%8CATEGORY %ITEM %3EFFORT")
|
|
||||||
;; (org-agenda-sorting-strategy '(priority-down effort-up))
|
|
||||||
;; (org-agenda-prefix-format " (%3e) %i %-12:c")))
|
|
||||||
;; ("R" "Reading list (requires estimating)" tags-todo
|
|
||||||
;; "TODO=\"READ\"+Effort=\"\"")
|
|
||||||
("r" . "Reading")
|
("r" . "Reading")
|
||||||
("rc" "Casual reading" tags-todo "TODO=\"READ\"+casual")
|
("rc" "Casual reading" tags-todo "TODO=\"READ\"+casual")
|
||||||
("rn" "Noteworthy reading" tags-todo "TODO=\"READ\"+note")
|
("rn" "Noteworthy reading" tags-todo "TODO=\"READ\"+note")
|
||||||
|
@ -776,6 +767,26 @@ After running it once remove it from `org-capture-after-finalize-hook'."
|
||||||
(org-goto-first-child)
|
(org-goto-first-child)
|
||||||
(list (point-marker))))
|
(list (point-marker))))
|
||||||
|
|
||||||
|
(defun org-edna-condition/day-of-week? (neg weekday)
|
||||||
|
(let ((condition (not (= (string-to-number (format-time-string "%u")) weekday))))
|
||||||
|
(when (xor condition neg)
|
||||||
|
"Not the right day.")))
|
||||||
|
|
||||||
|
(defun org-edna-condition/night-time? (neg)
|
||||||
|
"A condition for ‘org-edna’ see if it's what I consider nighttime."
|
||||||
|
(let* ((hour (nth 2 (decode-time)))
|
||||||
|
(condition (or (> hour 20)
|
||||||
|
(< hour 8))))
|
||||||
|
(when (xor condition neg)
|
||||||
|
"Too late!")))
|
||||||
|
|
||||||
|
(defun org-edna-condition/business-hours? (neg timezone)
|
||||||
|
"A condition for ‘org-edna’ to see if it's during regular business hours."
|
||||||
|
(let* ((hour (nth 2 (decode-time nil timezone)))
|
||||||
|
(condition (> 9 hour 18)))
|
||||||
|
(when (xor condition neg)
|
||||||
|
(format "Outside of business hours in %s!" timezone))))
|
||||||
|
|
||||||
;;; Refile
|
;;; Refile
|
||||||
|
|
||||||
(defun oni-org-refile-to-top ()
|
(defun oni-org-refile-to-top ()
|
||||||
|
|
Loading…
Reference in a new issue