[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 98651a0 09/13: Inverted definition of consideration
From: |
Ian Dunn |
Subject: |
[elpa] master 98651a0 09/13: Inverted definition of consideration |
Date: |
Sun, 25 Nov 2018 14:09:48 -0500 (EST) |
branch: master
commit 98651a08d0142b5a2e2130de98d21ad6b17be7e8
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Inverted definition of consideration
Makes it clearer how it works with the rest of the system.
* org-edna.el (org-edna-handle-consideration): Inverted semantics.
* org-edna-tests.el (org-edna-test-inhibit-messages): New defvar to silence
org
mode's messages during testing.
(org-edna-consideration/any): New test.
(org-edna-consideration/all):
(org-edna-consideration/integer):
(org-edna-consideration/float): Updated tests to match new semantics.
(org-edna-doc-test/daily): Expanded scope of test.
(org-edna-doc-test/snow-shoveling):
(org-edna-doc-test/consider-fraction):
(org-edna-doc-test/consider-number): New tests from docs.
* org-edna.org (Consideration): Updated section.
(Conditional Forms): Updated semantics of consideration.
* test.mk: Set `org-edna-test-inhibit-messages' to silence Org messages.
---
org-edna-tests.el | 278 ++++++++++++++++++++++++++++++++++++++++++++---------
org-edna-tests.org | 41 +++++++-
org-edna.el | 70 ++++++++------
org-edna.info | 261 ++++++++++++++++++++++++++++---------------------
org-edna.org | 92 ++++++++++++------
test.mk | 1 +
6 files changed, 532 insertions(+), 211 deletions(-)
diff --git a/org-edna-tests.el b/org-edna-tests.el
index 6f5fa5e..52c901a 100644
--- a/org-edna-tests.el
+++ b/org-edna-tests.el
@@ -26,6 +26,9 @@
(require 'ert)
(require 'org-id)
+(defvar org-edna-test-inhibit-messages nil
+ "Whether to inhibit messages (apart from ERT messages).")
+
(defconst org-edna-test-dir
(expand-file-name (file-name-directory (or load-file-name
buffer-file-name))))
@@ -1184,6 +1187,7 @@ This avoids org-id digging into its internal database."
(ert-deftest org-edna-action/todo-test ()
(let* ((org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"0d491588-7da3-43c5-b51a-87fbd34f79f7")))
(unwind-protect
(org-with-point-at target
@@ -1203,6 +1207,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"0d491588-7da3-43c5-b51a-87fbd34f79f7")))
(unwind-protect
(org-with-point-at target
@@ -1220,6 +1225,7 @@ This avoids org-id digging into its internal database."
(ert-deftest org-edna-action-scheduled/cp ()
(let* ((org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"0d491588-7da3-43c5-b51a-87fbd34f79f7"))
(source (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5"))
(pairs '((cp . rm) (copy . remove) ("cp" . "rm") ("copy" .
"remove"))))
@@ -1237,6 +1243,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5")))
(unwind-protect
(org-with-point-at target
@@ -1295,6 +1302,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5")))
(unwind-protect
(org-with-point-at target
@@ -1321,6 +1329,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"caf27724-0887-4565-9765-ed2f1edcfb16")))
(unwind-protect
(org-with-point-at target
@@ -1345,6 +1354,7 @@ This avoids org-id digging into its internal database."
(ert-deftest org-edna-action-scheduled/float ()
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5")))
(unwind-protect
(org-with-point-at target
@@ -1386,6 +1396,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"0d491588-7da3-43c5-b51a-87fbd34f79f7")))
(unwind-protect
(org-with-point-at target
@@ -1403,6 +1414,7 @@ This avoids org-id digging into its internal database."
(ert-deftest org-edna-action-deadline/cp ()
(let* ((org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"0d491588-7da3-43c5-b51a-87fbd34f79f7"))
(source (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5"))
(pairs '((cp . rm) (copy . remove) ("cp" . "rm") ("copy" .
"remove"))))
@@ -1420,6 +1432,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5")))
(unwind-protect
(org-with-point-at target
@@ -1478,6 +1491,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5")))
(unwind-protect
(org-with-point-at target
@@ -1504,6 +1518,7 @@ This avoids org-id digging into its internal database."
;; Override `current-time' so we can get a deterministic value
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
(org-agenda-files `(,org-edna-test-file))
+ (inhibit-message org-edna-test-inhibit-messages)
(target (org-edna-find-test-heading
"caf27724-0887-4565-9765-ed2f1edcfb16")))
(unwind-protect
(org-with-point-at target
@@ -1527,6 +1542,7 @@ This avoids org-id digging into its internal database."
(ert-deftest org-edna-action-deadline/float ()
(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
+ (inhibit-message org-edna-test-inhibit-messages)
(org-agenda-files `(,org-edna-test-file))
(target (org-edna-find-test-heading
"97e6b0f0-40c4-464f-b760-6e5ca9744eb5")))
(unwind-protect
@@ -1566,7 +1582,8 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-tag ()
- (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one)))
+ (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at pom
(org-edna-action/tag! nil "tag")
@@ -1576,7 +1593,8 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-property ()
- (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one)))
+ (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at pom
(org-edna-action/set-property! nil "TEST" "1")
@@ -1586,7 +1604,8 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-property/inc-dec ()
- (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one)))
+ (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at pom
(org-edna-action/set-property! nil "TEST" "1")
@@ -1608,7 +1627,8 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-property/next-prev ()
- (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one)))
+ (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at pom
(org-edna-action/set-property! nil "TEST" "a")
@@ -1639,7 +1659,8 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-clock ()
- (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one)))
+ (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at pom
(org-edna-action/clock-in! nil)
@@ -1651,6 +1672,7 @@ This avoids org-id digging into its internal database."
(ert-deftest org-edna-action-priority ()
(let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (inhibit-message org-edna-test-inhibit-messages)
(org-lowest-priority ?C)
(org-highest-priority ?A)
(org-default-priority ?B))
@@ -1669,7 +1691,8 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-effort ()
- (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one)))
+ (let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at pom
(org-edna-action/set-effort! nil "0:01")
@@ -1680,11 +1703,12 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-archive ()
- (let ((org-archive-save-context-info '(todo))
- (pom (org-edna-find-test-heading org-edna-test-archive-heading))
- ;; Archive it to the same location
- (org-archive-location "::** Archive")
- (org-edna-prompt-for-archive nil))
+ (let* ((inhibit-message org-edna-test-inhibit-messages)
+ (org-archive-save-context-info '(todo))
+ (pom (org-edna-find-test-heading org-edna-test-archive-heading))
+ ;; Archive it to the same location
+ (org-archive-location "::** Archive")
+ (org-edna-prompt-for-archive nil))
(unwind-protect
(org-with-point-at pom
(org-edna-action/archive! nil)
@@ -1693,7 +1717,8 @@ This avoids org-id digging into its internal database."
(org-edna-test-restore-test-file))))
(ert-deftest org-edna-action-chain ()
- (let ((old-pom (org-edna-find-test-heading org-edna-test-id-heading-one))
+ (let ((inhibit-message org-edna-test-inhibit-messages)
+ (old-pom (org-edna-find-test-heading org-edna-test-id-heading-one))
(new-pom (org-edna-find-test-heading org-edna-test-id-heading-two)))
(unwind-protect
(progn
@@ -1709,12 +1734,13 @@ This avoids org-id digging into its internal database."
;; Conditions
(defun org-edna-test-condition-form (func-sym pom-true pom-false block-true
block-false &rest args)
- (org-with-point-at pom-true
- (should-not (apply func-sym t args))
- (should (equal (apply func-sym nil args) block-true)))
- (org-with-point-at pom-false
- (should (equal (apply func-sym t args) block-false))
- (should-not (apply func-sym nil args))))
+ (let* ((inhibit-message org-edna-test-inhibit-messages))
+ (org-with-point-at pom-true
+ (should-not (apply func-sym t args))
+ (should (equal (apply func-sym nil args) block-true)))
+ (org-with-point-at pom-false
+ (should (equal (apply func-sym t args) block-false))
+ (should-not (apply func-sym nil args)))))
(ert-deftest org-edna-condition-done ()
(let* ((pom-done (org-edna-find-test-heading org-edna-test-id-heading-four))
@@ -1794,27 +1820,37 @@ This avoids org-id digging into its internal database."
;; Consideration
+(ert-deftest org-edna-consideration/any ()
+ (let ((blocks-all-blocking `("a" "c" "b"))
+ (blocks-some-blocking `("a" nil "b"))
+ (blocks-no-blocking `(nil nil nil)))
+ (should (string-equal (org-edna-handle-consideration 'any
blocks-all-blocking) "a"))
+ (should (string-equal (org-edna-handle-consideration 'any
blocks-some-blocking) "a"))
+ (should (not (org-edna-handle-consideration 'any blocks-no-blocking)))))
+
(ert-deftest org-edna-consideration/all ()
- (let ((blocks-blocking `("a" nil "b"))
+ (let ((blocks-all-blocking `("a" "c" "b"))
+ (blocks-some-blocking `(nil "c" nil))
(blocks-no-blocking `(nil nil nil)))
- (should (string-equal (org-edna-handle-consideration 'all blocks-blocking)
"a"))
+ (should (string-equal (org-edna-handle-consideration 'all
blocks-all-blocking) "a"))
+ (should (not (org-edna-handle-consideration 'all blocks-some-blocking)))
(should (not (org-edna-handle-consideration 'all blocks-no-blocking)))))
(ert-deftest org-edna-consideration/integer ()
- (let ((blocks-blocking `("a" "c" "b"))
- (blocks-no-blocking `("a" nil "b"))
- (blocks-empty `(nil nil nil)))
- (should (string-equal (org-edna-handle-consideration 1 blocks-blocking)
"a"))
- (should (not (org-edna-handle-consideration 1 blocks-no-blocking)))
- (should (not (org-edna-handle-consideration 1 blocks-empty)))))
+ (let ((blocks-all-blocking `("a" "c" "b"))
+ (blocks-some-blocking `("a" nil "b"))
+ (blocks-no-blocking `(nil nil nil)))
+ (should (string-equal (org-edna-handle-consideration 2
blocks-all-blocking) "a"))
+ (should (string-equal (org-edna-handle-consideration 2
blocks-some-blocking) "a"))
+ (should (not (org-edna-handle-consideration 2 blocks-no-blocking)))))
(ert-deftest org-edna-consideration/float ()
- (let ((blocks-blocking `("a" "c" "b"))
- (blocks-no-blocking `("a" nil "b"))
- (blocks-empty `(nil nil nil)))
- (should (string-equal (org-edna-handle-consideration 0.25 blocks-blocking)
"a"))
- (should (not (org-edna-handle-consideration 0.25 blocks-no-blocking)))
- (should (not (org-edna-handle-consideration 0.25 blocks-empty)))))
+ (let ((blocks-all-blocking `("a" "c" "b"))
+ (blocks-some-blocking `("a" nil "b"))
+ (blocks-no-blocking `(nil nil nil)))
+ (should (string-equal (org-edna-handle-consideration 0.25
blocks-all-blocking) "a"))
+ (should (string-equal (org-edna-handle-consideration 0.25
blocks-some-blocking) "a"))
+ (should (not (org-edna-handle-consideration 0.25 blocks-no-blocking)))))
;;; Full Run-through Tests from the Documentation
@@ -1823,7 +1859,8 @@ This avoids org-id digging into its internal database."
(let* ((start-heading (org-edna-find-test-heading
"24a0c3bb-7e69-4e9e-bb98-5aba2ff17bb1"))
(org-todo-keywords '((sequence "TODO" "|" "DONE")))
;; Only block based on Edna
- (org-blocker-hook 'org-edna-blocker-function))
+ (org-blocker-hook 'org-edna-blocker-function)
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at start-heading
(save-restriction
@@ -1856,7 +1893,8 @@ This avoids org-id digging into its internal database."
;; Only block based on Edna
(org-blocker-hook 'org-edna-blocker-function)
;; Enable cache
- (org-edna-finder-use-cache t))
+ (org-edna-finder-use-cache t)
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at start-heading
(save-restriction
@@ -1887,7 +1925,8 @@ This avoids org-id digging into its internal database."
(let* ((start-heading (org-edna-find-test-heading
"cc18dc74-00e8-4081-b46f-e36800041fe7"))
(org-todo-keywords '((sequence "TODO" "|" "DONE")))
;; Only block based on Edna
- (org-blocker-hook 'org-edna-blocker-function))
+ (org-blocker-hook 'org-edna-blocker-function)
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at start-heading
(save-restriction
@@ -1925,7 +1964,8 @@ This avoids org-id digging into its internal database."
;; Only block based on Edna
(org-blocker-hook 'org-edna-blocker-function)
;; Enable cache
- (org-edna-finder-use-cache t))
+ (org-edna-finder-use-cache t)
+ (inhibit-message org-edna-test-inhibit-messages))
(unwind-protect
(org-with-point-at start-heading
(save-restriction
@@ -1965,7 +2005,8 @@ This avoids org-id digging into its internal database."
;; Only block based on Edna
(org-blocker-hook 'org-edna-blocker-function)
;; Only trigger based on Edna
- (org-trigger-hook 'org-edna-trigger-function))
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
(org-with-point-at start-heading
(save-restriction
;; Only allow operating on the current tree
@@ -2021,7 +2062,8 @@ the relative finders all still work while cache is
enabled."
;; Only trigger based on Edna
(org-trigger-hook 'org-edna-trigger-function)
;; Enable cache
- (org-edna-finder-use-cache t))
+ (org-edna-finder-use-cache t)
+ (inhibit-message org-edna-test-inhibit-messages))
(org-with-point-at start-heading
(save-restriction
;; Only allow operating on the current tree
@@ -2073,7 +2115,8 @@ the relative finders all still work while cache is
enabled."
;; Only block based on Edna
(org-blocker-hook 'org-edna-blocker-function)
;; Only trigger based on Edna
- (org-trigger-hook 'org-edna-trigger-function))
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
(org-with-point-at start-heading
(save-restriction
;; Only allow operating on the current tree
@@ -2114,7 +2157,8 @@ the relative finders all still work while cache is
enabled."
;; Only trigger based on Edna
(org-trigger-hook 'org-edna-trigger-function)
;; Enable cache
- (org-edna-finder-use-cache t))
+ (org-edna-finder-use-cache t)
+ (inhibit-message org-edna-test-inhibit-messages))
(org-with-point-at start-heading
(save-restriction
;; Only allow operating on the current tree
@@ -2153,7 +2197,8 @@ the relative finders all still work while cache is
enabled."
;; Only block based on Edna
(org-blocker-hook 'org-edna-blocker-function)
;; Only trigger based on Edna
- (org-trigger-hook 'org-edna-trigger-function))
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
(org-with-point-at start-heading
(save-restriction
;; Only allow operating on the current tree
@@ -2171,7 +2216,21 @@ the relative finders all still work while cache is
enabled."
(should (org-edna-test-compare-todos door-pom "TODO" "Door after
Daily Trigger"))
(should (org-edna-test-compare-todos dog-pom "TODO" "Dog after
Daily Trigger"))
(should (string-equal (org-entry-get daily-pom "DEADLINE")
- "<2000-01-16 Sun +1d>")))
+ "<2000-01-16 Sun +1d>"))
+ ;; Check off Door. This should trigger the others.
+ (org-edna-test-mark-done door-pom)
+ (should (org-edna-test-compare-todos lunch-pom "TODO" "Lunch
after Door Trigger"))
+ (should (org-edna-test-compare-todos door-pom "TODO" "Door after
Door Trigger"))
+ (should (org-edna-test-compare-todos dog-pom "TODO" "Dog after
Door Trigger"))
+ (should (string-equal (org-entry-get daily-pom "DEADLINE")
+ "<2000-01-17 Mon +1d>"))
+ ;; Check off Dog. This should trigger the others.
+ (org-edna-test-mark-done dog-pom)
+ (should (org-edna-test-compare-todos lunch-pom "TODO" "Lunch
after Dog Trigger"))
+ (should (org-edna-test-compare-todos door-pom "TODO" "Door after
Dog Trigger"))
+ (should (org-edna-test-compare-todos dog-pom "TODO" "Dog after
Dog Trigger"))
+ (should (string-equal (org-entry-get daily-pom "DEADLINE")
+ "<2000-01-18 Tue +1d>")))
;; Change the test file back to its original state.
(org-edna-test-restore-test-file))))))
@@ -2184,7 +2243,8 @@ the relative finders all still work while cache is
enabled."
;; Only block based on Edna
(org-blocker-hook 'org-edna-blocker-function)
;; Only trigger based on Edna
- (org-trigger-hook 'org-edna-trigger-function))
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
(org-with-point-at start-heading
(save-restriction
;; Only allow operating on the current tree
@@ -2215,7 +2275,8 @@ the relative finders all still work while cache is
enabled."
;; Only block based on Edna
(org-blocker-hook 'org-edna-blocker-function)
;; Only trigger based on Edna
- (org-trigger-hook 'org-edna-trigger-function))
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
(org-with-point-at start-heading
(save-restriction
;; Only allow operating on the current tree
@@ -2247,6 +2308,135 @@ the relative finders all still work while cache is
enabled."
;; Change the test file back to its original state.
(org-edna-test-restore-test-file))))))
+(ert-deftest org-edna-doc-test/snow-shoveling ()
+ (cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
+ (start-heading (org-edna-find-test-heading
"b1d89bd8-db96-486e-874c-98e2b3a8cbf2"))
+ ;; Only use the test file in the agenda
+ (org-agenda-files `(,org-edna-test-file))
+ (org-todo-keywords '((sequence "TODO" "|" "DONE")))
+ ;; Only block based on Edna
+ (org-blocker-hook 'org-edna-blocker-function)
+ ;; Only trigger based on Edna
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
+ (org-with-point-at start-heading
+ (save-restriction
+ ;; Only allow operating on the current tree
+ (org-narrow-to-subtree)
+ ;; Show the entire subtree
+ (outline-show-all)
+ (unwind-protect
+ (let* ((monday-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (tuesday-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (wednesday-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (shovel-pom (progn (org-next-visible-heading 1)
(point-marker))))
+ ;; Verify shovels is blocked
+ (should (org-edna-test-check-block shovel-pom "Initial Shovel
Check"))
+
+ ;; Mark Monday as done
+ (org-edna-test-mark-done monday-pom)
+ (should (not (org-edna-test-check-block shovel-pom "Shovel after
changing Monday")))
+ ;; Reset
+ (org-edna-test-mark-todo monday-pom tuesday-pom wednesday-pom
shovel-pom)
+
+ ;; Mark Tuesday as done
+ (org-edna-test-mark-done tuesday-pom)
+ (should (not (org-edna-test-check-block shovel-pom "Shovel after
changing Tuesday")))
+
+ ;; Reset
+ (org-edna-test-mark-todo monday-pom tuesday-pom wednesday-pom
shovel-pom)
+ ;; Mark Wednesday as done
+ (org-edna-test-mark-done wednesday-pom)
+ (should (not (org-edna-test-check-block shovel-pom "Shovel after
changing Wednesday"))))
+ ;; Change the test file back to its original state.
+ (org-edna-test-restore-test-file))))))
+
+(ert-deftest org-edna-doc-test/consider-fraction ()
+ (cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
+ (start-heading (org-edna-find-test-heading
"7de5af8b-a226-463f-8360-edd88b99462a"))
+ ;; Only use the test file in the agenda
+ (org-agenda-files `(,org-edna-test-file))
+ (org-todo-keywords '((sequence "TODO" "|" "DONE")))
+ ;; Only block based on Edna
+ (org-blocker-hook 'org-edna-blocker-function)
+ ;; Only trigger based on Edna
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
+ (org-with-point-at start-heading
+ (save-restriction
+ ;; Only allow operating on the current tree
+ (org-narrow-to-subtree)
+ ;; Show the entire subtree
+ (outline-show-all)
+ (unwind-protect
+ (let* ((shovel-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (room-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (vacuum-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (lunch-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (edna-pom (progn (org-next-visible-heading 1)
(point-marker))))
+ ;; Verify Edna is blocked
+ (should (org-edna-test-check-block edna-pom "Initial Edna
Check"))
+
+ ;; Mark Shovel snow as done
+ (org-edna-test-mark-done shovel-pom)
+ ;; Verify Edna is still blocked
+ (should (org-edna-test-check-block edna-pom "Edna Check after
Shovel"))
+
+ ;; Mark Vacuum as done
+ (org-edna-test-mark-done vacuum-pom)
+ ;; Verify Edna is still blocked
+ (should (org-edna-test-check-block edna-pom "Edna Check after
Vacuum"))
+
+ ;; Mark Room as done
+ (org-edna-test-mark-done room-pom)
+ ;; Verify Edna is no longer blocked
+ (should (not (org-edna-test-check-block edna-pom "Edna Check
after Room"))))
+ ;; Change the test file back to its original state.
+ (org-edna-test-restore-test-file))))))
+
+(ert-deftest org-edna-doc-test/consider-number ()
+ (cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
+ (start-heading (org-edna-find-test-heading
"b79279f7-be3c-45ac-96dc-6e962a5873d4"))
+ ;; Only use the test file in the agenda
+ (org-agenda-files `(,org-edna-test-file))
+ (org-todo-keywords '((sequence "TODO" "|" "DONE")))
+ ;; Only block based on Edna
+ (org-blocker-hook 'org-edna-blocker-function)
+ ;; Only trigger based on Edna
+ (org-trigger-hook 'org-edna-trigger-function)
+ (inhibit-message org-edna-test-inhibit-messages))
+ (org-with-point-at start-heading
+ (save-restriction
+ ;; Only allow operating on the current tree
+ (org-narrow-to-subtree)
+ ;; Show the entire subtree
+ (outline-show-all)
+ (unwind-protect
+ (let* ((shovel-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (room-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (vacuum-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (lunch-pom (progn (org-next-visible-heading 1)
(point-marker)))
+ (edna-pom (progn (org-next-visible-heading 1)
(point-marker))))
+ ;; Verify Edna is blocked
+ (should (org-edna-test-check-block edna-pom "Initial Edna
Check"))
+
+ ;; Mark Shovel snow as done
+ (org-edna-test-mark-done shovel-pom)
+ ;; Verify Edna is still blocked
+ (should (org-edna-test-check-block edna-pom "Edna Check after
Shovel"))
+
+ ;; Mark Vacuum as done
+ (org-edna-test-mark-done vacuum-pom)
+ ;; Verify Edna is still blocked
+ (should (org-edna-test-check-block edna-pom "Edna Check after
Vacuum"))
+
+ ;; Mark Room as done
+ (org-edna-test-mark-done room-pom)
+ ;; Verify Edna is no longer blocked
+ (should (not (org-edna-test-check-block edna-pom "Edna Check
after Room"))))
+ ;; Change the test file back to its original state.
+ (org-edna-test-restore-test-file))))))
+
(provide 'org-edna-tests)
;;; org-edna-tests.el ends here
diff --git a/org-edna-tests.org b/org-edna-tests.org
index 4d9aa9d..35d5455 100644
--- a/org-edna-tests.org
+++ b/org-edna-tests.org
@@ -231,15 +231,15 @@ DEADLINE: <2000-01-15 Sat +1d>
:END:
*** TODO Prepare Tomorrow's Lunch :daily:
:PROPERTIES:
-:TRIGGER: if consider(any) match("daily") then
ids(96f7e46c-40c3-4f5b-8f00-81a6e3cb122b) todo!(DONE) endif
+:TRIGGER: if consider(all) match("daily") then
ids(96f7e46c-40c3-4f5b-8f00-81a6e3cb122b) todo!(DONE) endif
:END:
*** TODO Lock Back Door :daily:
:PROPERTIES:
-:TRIGGER: if consider(any) match("daily") then
ids(96f7e46c-40c3-4f5b-8f00-81a6e3cb122b) todo!(DONE) endif
+:TRIGGER: if consider(3) match("daily") then
ids(96f7e46c-40c3-4f5b-8f00-81a6e3cb122b) todo!(DONE) endif
:END:
*** TODO Feed Dog :daily:
:PROPERTIES:
-:TRIGGER: if consider(any) match("daily") then
ids(96f7e46c-40c3-4f5b-8f00-81a6e3cb122b) todo!(DONE) endif
+:TRIGGER: if consider(0.9) match("daily") then
ids(96f7e46c-40c3-4f5b-8f00-81a6e3cb122b) todo!(DONE) endif
:END:
** Weeklies - Inverted Conditional
:PROPERTIES:
@@ -277,3 +277,38 @@ DEADLINE: <2000-01-15 Sat +1d>
:BLOCKER: previous-sibling !has-property?("COUNT" "3")
:TRIGGER: previous-sibling set-property!("COUNT" "0")
:END:
+** Snow Shoveling
+:PROPERTIES:
+:ID: b1d89bd8-db96-486e-874c-98e2b3a8cbf2
+:END:
+*** TODO Shovel on Monday
+*** TODO Shovel on Tuesday
+*** TODO Shovel on Wednesday
+*** TODO Put shovel away
+:PROPERTIES:
+:BLOCKER: consider(all) rest-of-siblings-wrap
+:END:
+** Work I - Consider Fraction
+:PROPERTIES:
+:ID: 7de5af8b-a226-463f-8360-edd88b99462a
+:END:
+*** TODO Shovel Snow
+*** TODO Clean room
+*** TODO Vacuum
+*** TODO Eat lunch
+*** TODO Work on Edna
+:PROPERTIES:
+:BLOCKER: consider(0.5) rest-of-siblings-wrap
+:END:
+** Work II - Consider Number
+:PROPERTIES:
+:ID: b79279f7-be3c-45ac-96dc-6e962a5873d4
+:END:
+*** TODO Shovel Snow
+*** TODO Clean room
+*** TODO Vacuum
+*** TODO Eat lunch
+*** TODO Work on Edna
+:PROPERTIES:
+:BLOCKER: consider(2) rest-of-siblings-wrap
+:END:
diff --git a/org-edna.el b/org-edna.el
index 36f3afa..929d8ff 100644
--- a/org-edna.el
+++ b/org-edna.el
@@ -2023,49 +2023,65 @@ starting from target's position."
(defun org-edna-handle-consideration (consideration blocks)
"Handle consideration CONSIDERATION.
-Edna Syntax: consider(all) [1]
+Edna Syntax: consider(any) [1]
Edna Syntax: consider(N) [2]
Edna Syntax: consider(P) [3]
-Edna Syntax: consider(any) [4]
+Edna Syntax: consider(all) [4]
-Form 1: consider all targets when evaluating conditions.
-Form 2: consider the condition met if only N of the targets pass.
-Form 3: consider the condition met if only P% of the targets pass.
-Form 4: consider the condition met if any target meets it
+A blocker can be read as:
+\"If ANY heading in TARGETS matches CONDITION, block this heading\"
-If CONSIDERATION is nil, default to 'all.
+The consideration is \"ANY\".
+
+Form 1 blocks only if any target matches the condition. This is
+the default.
+
+Form 2 blocks only if at least N targets meet the condition. N=1
+is the same as 'any'.
+
+Form 3 blocks only if *at least* fraction P of the targets meet
+the condition. This should be a decimal value between 0 and 1.
+
+Form 4 blocks only if all targets match the condition.
+
+The default consideration is \"any\".
+
+If CONSIDERATION is nil, default to 'any.
The \"consideration\" keyword is also provided. It functions the
same as \"consider\"."
- ;; BLOCKS is a list of blocking entries; if one isn't blocked, its entry will
- ;; be nil.
- (let ((consideration (or consideration 'all))
- (first-block (seq-find #'identity blocks))
- (total-blocks (seq-length blocks))
- (fulfilled (seq-count #'not blocks)))
+ ;; BLOCKS is a list of entries that meets the blocking condition; if one
isn't
+ ;; blocked, its entry will be nil.
+ (let* ((consideration (or consideration 'any))
+ (first-block (seq-find #'identity blocks))
+ (total-blocks (seq-length blocks))
+ (fulfilled (seq-count #'not blocks))
+ (blocked (- total-blocks fulfilled)))
(pcase consideration
- ('all
- ;; All of them must be fulfilled, so find the first one that isn't.
- first-block)
('any
- ;; Any of them can be fulfilled, so find the first one that is
+ ;; In order to pass, all of them must be fulfilled, so find the first
one
+ ;; that isn't.
+ first-block)
+ ('all
+ ;; All of them must be set to block, so if one of them doesn't block,
the
+ ;; entire entry won't block.
(if (> fulfilled 0)
;; Have one fulfilled
nil
;; None of them are fulfilled
first-block))
((pred integerp)
- ;; A fixed number of them must be fulfilled, so check how many aren't.
- (let* ((fulfilled (seq-count #'not blocks)))
- (if (>= fulfilled consideration)
- nil
- first-block)))
+ ;; A minimum number of them must meet the blocking condition, so check
+ ;; how many block.
+ (if (>= blocked consideration)
+ first-block
+ nil))
((pred floatp)
- ;; A certain percentage of them must be fulfilled
- (let* ((fulfilled (seq-count #'not blocks)))
- (if (>= (/ (float fulfilled) (float total-blocks)) consideration)
- nil
- first-block))))))
+ ;; A certain percentage of them must block for the blocker to block.
+ (let* ((float-blocked (/ (float blocked) (float total-blocks))))
+ (if (>= float-blocked consideration)
+ first-block
+ nil))))))
;;; Popout editing
diff --git a/org-edna.info b/org-edna.info
index de1c087..691f110 100644
--- a/org-edna.info
+++ b/org-edna.info
@@ -113,6 +113,7 @@ Contributing
Changelog
+* 1.0: 10.
* 1.0beta8: 10beta8.
* 1.0beta7: 10beta7.
* 1.0beta6: 10beta6.
@@ -668,6 +669,8 @@ and for similarity to org-depend.
• scheduled-down: Scheduled time, closest first
• deadline-up: Deadline time, farthest first
• deadline-down: Deadline time, closest first
+ • timestamp-up: Timestamp time, farthest first
+ • timestamp-down: Timestamp time, closest first
Many of the other finders are shorthand for argument combinations of
relative:
@@ -1301,43 +1304,71 @@ Consideration
“Consideration” and “consider” are special keywords that are only valid
for blockers.
- This says “Allow a task to complete if CONSIDERATION of its targets
-pass the given condition”.
+ A blocker says “If ANY heading in TARGETS meets CONDITION, block this
+task”.
- This keyword can allow specifying only a portion of tasks to
-consider:
+ In order to modify the ANY part of that statement, the ‘consider’
+keyword may be used:
- 1. consider(PERCENT)
- 2. consider(NUMBER)
- 3. consider(all) (Default)
- 4. consider(any)
+ 1. consider(any)
+ 2. consider(all)
+ 3. consider(FRACTION)
+ 4. consider(NUMBER)
- (1) tells the blocker to only consider some portion of the targets.
-If at least PERCENT of them are in a DONE state, allow the task to be
-set to DONE. PERCENT must be a decimal, and doesn’t need to include a
-%-sign.
+ (1) blocks the current task if any target meets the blocking
+condition. This is the default case.
- (2) tells the blocker to only consider NUMBER of the targets.
+ (2) blocks the current task only if all targets meet the blocking
+condition.
- (3) tells the blocker to consider all following targets.
+ * Shovel Snow
+ ** TODO Shovel on Monday
+ ** TODO Shovel on Tuesday
+ ** TODO Shovel on Wednesday
+ ** TODO Put shovel away
+ :PROPERTIES:
+ :BLOCKER: consider(all) rest-of-siblings-wrap
+ :END:
- (4) tells the blocker to allow passage if any of the targets pass.
+ The above example blocks “Put shovel away” so long as all of the
+siblings are still marked TODO.
- A consideration must be specified before the conditions to which it
-applies:
+ (3) blocks the current task if at least FRACTION of the targets meet
+the blocking condition.
- consider(0.5) siblings match("find_me") consider(all) !done?
+ * Work
+ ** TODO Shovel Snow
+ ** TODO Clean room
+ ** TODO Vacuum
+ ** TODO Eat lunch
+ ** TODO Work on Edna
+ :PROPERTIES:
+ :BLOCKER: consider(0.5) rest-of-siblings-wrap
+ :END:
- The above code will allow task completion if at least half the
-siblings are complete, and all tasks tagged “find_me” are complete.
+ The above example blocks “Work on Edna” so long as at least half of
+the siblings are marked TODO. This means that three of them must be
+completed before development can begin on Edna.
- consider(1) ids(ID1 ID2 ID3) consider(2) ids(ID3 ID4 ID5 ID6)
+ (4) blocks the current task if at least NUMBER of the targets meet
+the blocking condition.
- The above code will allow task completion if at least one of ID1,
-ID2, and ID3 are complete, and at least two of ID3, ID4, ID5, and ID6
-are complete.
+ * Work
+ ** TODO Shovel Snow
+ ** TODO Clean room
+ ** TODO Vacuum
+ ** TODO Eat lunch
+ ** TODO Work on Edna
+ :PROPERTIES:
+ :BLOCKER: consider(2) rest-of-siblings-wrap
+ :END:
- If no consideration is given, ALL is assumed.
+ The above example blocks “Work on Edna” so long as two of the
+siblings are marked TODO. This means that NUMBER=1 is the same as
+specifying ‘any’.
+
+ A consideration must be specified before the conditions to which it
+applies.
Both “consider” and “consideration” are valid keywords; they both
mean the same thing.
@@ -1391,18 +1422,18 @@ it won’t trigger the original until the last one is
marked DONE.
Occasionally, you may find that you’d rather execute a form if the
condition *would* block. There are two options.
- The first is confusing: use ‘consider(any)’. This will tell Edna to
-pass so long as one of the targets meets the condition. This is the
-opposite of Edna’s standard operation, which only allows passage if all
-targets meet the condition.
+ The first is to use ‘consider(all)’. This will tell Edna to block
+only if all of the targets meets the condition, and thus not block if at
+least one of them does not meet the condition. This is the opposite of
+Edna’s standard operation, which only allows passage if all targets meet
+the condition.
* TODO Prepare Tomorrow's Lunch
:nightly:
:PROPERTIES:
- :TRIGGER: if consider(any) match("nightly") then ids(12345)
todo!(DONE) endif
+ :TRIGGER: if consider(all) match("nightly") then ids(12345)
todo!(DONE) endif
:END:
- The second is a lot easier to understand: just switch the then and
-else clauses:
+ The second is to switch the then and else clauses:
* TODO Prepare Tomorrow's Lunch
:nightly:
:PROPERTIES:
@@ -1729,6 +1760,7 @@ Changelog
* Menu:
+* 1.0: 10.
* 1.0beta8: 10beta8.
* 1.0beta7: 10beta7.
* 1.0beta6: 10beta6.
@@ -1738,7 +1770,21 @@ Changelog
* 1.0beta2: 10beta2.
-File: org-edna.info, Node: 10beta8, Next: 10beta7, Up: Changelog
+File: org-edna.info, Node: 10, Next: 10beta8, Up: Changelog
+
+1.0
+===
+
+ • Various bugs fixes
+ • Fixed parsing of consideration
+ • Limited cache to just the finders that don’t depend on current
+ position
+ • Added “buffer” option for match finder
+ • Added timestamp sorting to relatives finder
+ • Inverted meaning of consideration to avoid confusion
+
+
+File: org-edna.info, Node: 10beta8, Next: 10beta7, Prev: 10, Up: Changelog
1.0beta8
========
@@ -1852,80 +1898,81 @@ Big release here, with three new features.
Tag Table:
Node: Top225
-Node: Copying4206
-Node: Introduction5028
-Node: Installation and Setup5976
-Node: Basic Operation6700
-Node: Blockers8551
-Node: Triggers8837
-Node: Syntax9099
-Node: Basic Features9789
-Node: Finders10143
-Node: ancestors11908
-Node: children12502
-Node: descendants12912
-Node: file13434
-Node: first-child14183
-Node: ids14443
-Node: match15104
-Node: next-sibling15742
-Node: next-sibling-wrap15999
-Node: olp16313
-Node: org-file16725
-Node: parent17370
-Node: previous-sibling17568
-Node: previous-sibling-wrap17829
-Node: relatives18108
-Node: rest-of-siblings21729
-Node: rest-of-siblings-wrap22014
-Node: self22363
-Node: siblings22524
-Node: siblings-wrap22761
-Node: Actions23065
-Node: Scheduled/Deadline23828
-Node: TODO State27343
-Node: Archive28068
-Node: Chain Property28388
-Node: Clocking29141
-Node: Property29553
-Node: Priority31726
-Node: Tag32295
-Node: Effort32512
-Node: Getting Help32896
-Node: Advanced Features33341
-Node: Finder Cache33789
-Node: Conditions34828
-Node: Heading is DONE35505
-Node: File Has Headings35711
-Node: Heading TODO State36133
-Node: Lisp Variable Set36427
-Node: Heading Has Property37095
-Node: Regexp Search37841
-Node: Negating Conditions38221
-Node: Consideration38612
-Node: Conditional Forms40200
-Node: Setting the Properties42856
-Node: Extending Edna43940
-Node: Naming Conventions44430
-Node: Finders 145222
-Node: Actions 145584
-Node: Conditions 146043
-Node: Contributing46929
-Node: Bugs47795
-Node: Working with EDE48152
-Node: Compiling Edna49236
-Node: Testing Edna50105
-Node: Before Sending Changes51086
-Node: Developing with Bazaar51773
-Node: Documentation52514
-Node: Changelog52970
-Node: 10beta853220
-Node: 10beta753332
-Node: 10beta653626
-Node: 10beta553902
-Node: 10beta454289
-Node: 10beta354542
-Node: 10beta254981
+Node: Copying4217
+Node: Introduction5039
+Node: Installation and Setup5987
+Node: Basic Operation6711
+Node: Blockers8562
+Node: Triggers8848
+Node: Syntax9110
+Node: Basic Features9800
+Node: Finders10154
+Node: ancestors11919
+Node: children12513
+Node: descendants12923
+Node: file13445
+Node: first-child14194
+Node: ids14454
+Node: match15115
+Node: next-sibling15753
+Node: next-sibling-wrap16010
+Node: olp16324
+Node: org-file16736
+Node: parent17381
+Node: previous-sibling17579
+Node: previous-sibling-wrap17840
+Node: relatives18119
+Node: rest-of-siblings21845
+Node: rest-of-siblings-wrap22130
+Node: self22479
+Node: siblings22640
+Node: siblings-wrap22877
+Node: Actions23181
+Node: Scheduled/Deadline23944
+Node: TODO State27459
+Node: Archive28184
+Node: Chain Property28504
+Node: Clocking29257
+Node: Property29669
+Node: Priority31842
+Node: Tag32411
+Node: Effort32628
+Node: Getting Help33012
+Node: Advanced Features33457
+Node: Finder Cache33905
+Node: Conditions34944
+Node: Heading is DONE35621
+Node: File Has Headings35827
+Node: Heading TODO State36249
+Node: Lisp Variable Set36543
+Node: Heading Has Property37211
+Node: Regexp Search37957
+Node: Negating Conditions38337
+Node: Consideration38728
+Node: Conditional Forms40912
+Node: Setting the Properties43600
+Node: Extending Edna44684
+Node: Naming Conventions45174
+Node: Finders 145966
+Node: Actions 146328
+Node: Conditions 146787
+Node: Contributing47673
+Node: Bugs48539
+Node: Working with EDE48896
+Node: Compiling Edna49980
+Node: Testing Edna50849
+Node: Before Sending Changes51830
+Node: Developing with Bazaar52517
+Node: Documentation53258
+Node: Changelog53714
+Node: 1053975
+Node: 10beta854377
+Node: 10beta754500
+Node: 10beta654794
+Node: 10beta555070
+Node: 10beta455457
+Node: 10beta355710
+Node: 10beta256149
End Tag Table
diff --git a/org-edna.org b/org-edna.org
index 38fe539..2188f53 100644
--- a/org-edna.org
+++ b/org-edna.org
@@ -1093,43 +1093,73 @@ tagged "test" does *not* have the property PROP set to
"1".
"Consideration" and "consider" are special keywords that are only valid for
blockers.
-This says "Allow a task to complete if CONSIDERATION of its targets pass the
-given condition".
+A blocker says "If ANY heading in TARGETS meets CONDITION, block this task".
-This keyword can allow specifying only a portion of tasks to consider:
+In order to modify the ANY part of that statement, the ~consider~ keyword may
be
+used:
-1. consider(PERCENT)
-2. consider(NUMBER)
-3. consider(all) (Default)
-4. consider(any)
+1. consider(any)
+2. consider(all)
+3. consider(FRACTION)
+4. consider(NUMBER)
-(1) tells the blocker to only consider some portion of the targets. If at
least
-PERCENT of them are in a DONE state, allow the task to be set to DONE. PERCENT
-must be a decimal, and doesn't need to include a %-sign.
+(1) blocks the current task if any target meets the blocking condition. This
is
+the default case.
-(2) tells the blocker to only consider NUMBER of the targets.
+(2) blocks the current task only if all targets meet the blocking condition.
-(3) tells the blocker to consider all following targets.
+#+begin_src org
+,* Shovel Snow
+,** TODO Shovel on Monday
+,** TODO Shovel on Tuesday
+,** TODO Shovel on Wednesday
+,** TODO Put shovel away
+ :PROPERTIES:
+ :BLOCKER: consider(all) rest-of-siblings-wrap
+ :END:
+#+end_src
-(4) tells the blocker to allow passage if any of the targets pass.
+The above example blocks "Put shovel away" so long as all of the siblings are
+still marked TODO.
-A consideration must be specified before the conditions to which it applies:
+(3) blocks the current task if at least FRACTION of the targets meet the
+blocking condition.
-#+BEGIN_EXAMPLE
-consider(0.5) siblings match("find_me") consider(all) !done?
-#+END_EXAMPLE
+#+begin_src org
+,* Work
+,** TODO Shovel Snow
+,** TODO Clean room
+,** TODO Vacuum
+,** TODO Eat lunch
+,** TODO Work on Edna
+ :PROPERTIES:
+ :BLOCKER: consider(0.5) rest-of-siblings-wrap
+ :END:
+#+end_src
-The above code will allow task completion if at least half the siblings are
-complete, and all tasks tagged "find_me" are complete.
+The above example blocks "Work on Edna" so long as at least half of the
siblings
+are marked TODO. This means that three of them must be completed before
+development can begin on Edna.
-#+BEGIN_SRC emacs-lisp
-consider(1) ids(ID1 ID2 ID3) consider(2) ids(ID3 ID4 ID5 ID6)
-#+END_SRC
+(4) blocks the current task if at least NUMBER of the targets meet the blocking
+condition.
+
+#+begin_src org
+,* Work
+,** TODO Shovel Snow
+,** TODO Clean room
+,** TODO Vacuum
+,** TODO Eat lunch
+,** TODO Work on Edna
+ :PROPERTIES:
+ :BLOCKER: consider(2) rest-of-siblings-wrap
+ :END:
+#+end_src
-The above code will allow task completion if at least one of ID1, ID2, and ID3
-are complete, and at least two of ID3, ID4, ID5, and ID6 are complete.
+The above example blocks "Work on Edna" so long as two of the siblings are
+marked TODO. This means that NUMBER=1 is the same as specifying ~any~.
-If no consideration is given, ALL is assumed.
+A consideration must be specified before the conditions to which it applies.
Both "consider" and "consideration" are valid keywords; they both mean the same
thing.
@@ -1188,18 +1218,19 @@ trigger the original until the last one is marked DONE.
Occasionally, you may find that you'd rather execute a form if the condition
*would* block. There are two options.
-The first is confusing: use ~consider(any)~. This will tell Edna to pass so
-long as one of the targets meets the condition. This is the opposite of Edna's
-standard operation, which only allows passage if all targets meet the
condition.
+The first is to use ~consider(all)~. This will tell Edna to block only if all
+of the targets meets the condition, and thus not block if at least one of them
+does not meet the condition. This is the opposite of Edna's standard
operation,
+which only allows passage if all targets meet the condition.
#+begin_src org
,* TODO Prepare Tomorrow's Lunch :nightly:
:PROPERTIES:
- :TRIGGER: if consider(any) match("nightly") then ids(12345) todo!(DONE)
endif
+ :TRIGGER: if consider(all) match("nightly") then ids(12345) todo!(DONE)
endif
:END:
#+end_src
-The second is a lot easier to understand: just switch the then and else
clauses:
+The second is to switch the then and else clauses:
#+begin_src org
,* TODO Prepare Tomorrow's Lunch :nightly:
@@ -1512,6 +1543,7 @@ making any changes:
- Limited cache to just the finders that don't depend on current position
- Added "buffer" option for match finder
- Added timestamp sorting to relatives finder
+- Inverted meaning of consideration to avoid confusion
** 1.0beta8
Quick fix for beta7.
diff --git a/test.mk b/test.mk
index 29e31e5..4b6590c 100644
--- a/test.mk
+++ b/test.mk
@@ -23,6 +23,7 @@ test: compile
-L "." \
-l "ert" \
-l "org-edna-tests.el" \
+ --eval "(setq org-edna-test-inhibit-messages t)" \
-f ert-run-tests-batch-and-exit
include Makefile
- [elpa] master updated (7cacd8a -> 76ef9bf), Ian Dunn, 2018/11/25
- [elpa] master a7286e6 03/13: Mention consider in opening of Consideration section, Ian Dunn, 2018/11/25
- [elpa] master 85b5f4e 04/13: Modified cache to only work for specific finders, Ian Dunn, 2018/11/25
- [elpa] master 9dea42d 02/13: Added note about naming conventions., Ian Dunn, 2018/11/25
- [elpa] master 0194996 01/13: Added org-edna-describe-keyword function, Ian Dunn, 2018/11/25
- [elpa] master 1bb1fed 08/13: Added timestamp sorting to relatives finder, Ian Dunn, 2018/11/25
- [elpa] master 2c5ac0c 12/13: Bumped version, Ian Dunn, 2018/11/25
- [elpa] master 58be309 06/13: Fixed up description of set-effort!., Ian Dunn, 2018/11/25
- [elpa] master c6b3234 07/13: Additional tests and minor cleanup, Ian Dunn, 2018/11/25
- [elpa] master cb98c0f 10/13: Removed remnants of old build system, Ian Dunn, 2018/11/25
- [elpa] master 98651a0 09/13: Inverted definition of consideration,
Ian Dunn <=
- [elpa] master 45310da 05/13: Various fixes from testing, Ian Dunn, 2018/11/25
- [elpa] master 26d2a0d 11/13: Added has-tags? and matches? conditions, Ian Dunn, 2018/11/25
- [elpa] master 76ef9bf 13/13: Merge commit '2c5ac0cb808ae6953fbc74cc497245dafb51051f', Ian Dunn, 2018/11/25