aboutsummaryrefslogtreecommitdiffstats
path: root/oni-org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2023-04-11 20:23:23 -0700
committerGravatar Tom Willemse2023-04-11 20:23:23 -0700
commit348f71e57084ebeda4b033de4ff6b7dfadfa8fef (patch)
treeeb5e91eeff6ef5f041413d4f96de8240bddd5334 /oni-org
parentc76c23699179fd69060f005d1ba43e001972abc6 (diff)
downloademacs-config-348f71e57084ebeda4b033de4ff6b7dfadfa8fef.tar.gz
emacs-config-348f71e57084ebeda4b033de4ff6b7dfadfa8fef.zip
[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.
Diffstat (limited to 'oni-org')
-rw-r--r--oni-org/oni-org.el33
1 files changed, 22 insertions, 11 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el
index 7a95721..dd28a4f 100644
--- a/oni-org/oni-org.el
+++ b/oni-org/oni-org.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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)
;; 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-custom-commands
- `(("t" . "Things to do")
- ("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=\"\"")
+ `(("t" "Todo" tags-todo "TODO=\"TODO\"-CATEGORY=\"project\"+(SCHEDULED<\"<tomorrow>\"|TODO=\"TODO\"-CATEGORY=\"project\"+SCHEDULED=\"\")")
("r" . "Reading")
("rc" "Casual reading" tags-todo "TODO=\"READ\"+casual")
("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)
(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
(defun oni-org-refile-to-top ()