Change/Fix: Restore today arguments to ts-related predicates

Also, DRY some code into a macro.  Much cleaner.
This commit is contained in:
Adam Porter 2019-08-19 03:16:24 -05:00
parent 4d97dc6234
commit ed32701772
3 changed files with 153 additions and 170 deletions

View file

@ -270,9 +270,9 @@ This macro is like ~org-ql~, but it presents matching entries in an Agenda-like
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(org-ql-agenda "~/src/emacs/org-super-agenda/test/test.org" (org-ql-agenda "~/src/emacs/org-super-agenda/test/test.org"
(and (or (date = today) (and (or (ts-active :on today)
(deadline <=) (deadline auto)
(scheduled <= today)) (scheduled :to today))
(not (done))) (not (done)))
:title "My Agenda View" :title "My Agenda View"
;; The `org-super-agenda-groups' setting is used automatically when set, or it ;; The `org-super-agenda-groups' setting is used automatically when set, or it

203
org-ql.el
View file

@ -206,7 +206,7 @@ non-nil."
;; TODO: Figure out how to use or reimplement the org-scanner-tags feature. ;; TODO: Figure out how to use or reimplement the org-scanner-tags feature.
;; (org-use-tag-inheritance t) ;; (org-use-tag-inheritance t)
;; (org-trust-scanner-tags t) ;; (org-trust-scanner-tags t)
(org-ql--today (org-today)) (org-ql--today (ts-now))
(items (->> buffers (items (->> buffers
(--map (with-current-buffer it (--map (with-current-buffer it
(unless (derived-mode-p 'org-mode) (unless (derived-mode-p 'org-mode)
@ -318,155 +318,62 @@ Replaces bare strings with (regexp) selectors, and appropriate
(_ element)))) (_ element))))
(rec query))) (rec query)))
(defmacro org-ql--from-to-on ()
"For internal use.
Expands into a form that processes arguments to timestamp-related
predicates."
;; Several attempts to use `cl-macrolet' and `cl-symbol-macrolet' failed, so I
;; resorted to this top-level macro. It will do for now.
`(progn
(when on
(setq from on
to on))
(when from
(setq from (pcase from
((pred stringp) (ts-parse-fill 'begin from))
((pred numberp) (->> (ts-now)
(ts-adjust 'day from)
(ts-apply :hour 0 :minute 0 :second 0)))
((pred ts-p) from)
('today (->> (ts-now)
(ts-apply :hour 0 :minute 0 :second 0))))))
(when to
(setq to (pcase to
((pred stringp) (ts-parse-fill 'end to))
((pred numberp) (->> (ts-now)
(ts-adjust 'day to)
(ts-apply :hour 23 :minute 59 :second 59)))
((pred ts-p) to)
('today (->> (ts-now)
(ts-apply :hour 23 :minute 59 :second 59))))))))
(defun org-ql--query-predicate (query) (defun org-ql--query-predicate (query)
"Return predicate function for QUERY." "Return predicate function for QUERY."
(byte-compile `(lambda () (byte-compile
;; This is either really elegant or really ugly. Well, also `(lambda ()
;; possibly somewhere in-between. At the least, we should do (cl-macrolet ((clocked (&key from to on)
;; this in a more flexible, abstracted way, but this will do (org-ql--from-to-on)
;; for now. Most importantly, it works! `(org-ql--predicate-clocked :from ,from :to ,to))
(let (from to on) (closed (&key from to on)
;; TODO: DRY these macrolets. (org-ql--from-to-on)
;; MAYBE: Instead of defining clocked, closed, etc. as predicates, `(org-ql--predicate-closed :from ,from :to ,to))
;; rewrite them to call --predicate-ts directly here. Only drawback, (deadline (&key from to on)
;; I think, is that it would make documentation less automated. (org-ql--from-to-on)
(cl-macrolet ((clocked (&key from to on) `(org-ql--predicate-deadline :from ,from :to ,to))
(when on (planning (&key from to on)
(setq from on (org-ql--from-to-on)
to on)) `(org-ql--predicate-planning :from ,from :to ,to))
(when from (scheduled (&key from to on)
(setq from (cl-etypecase from (org-ql--from-to-on)
(string (ts-parse-fill 'begin from)) `(org-ql--predicate-scheduled :from ,from :to ,to))
(number (->> (ts-now) (ts (&key from to on (type 'both))
(ts-adjust 'day from) (org-ql--from-to-on)
(ts-apply :hour 0 :minute 0 :second 0))) `(org-ql--predicate-ts :from ,from :to ,to
(ts from)))) :regexp ,(pcase type
(when to ('both org-tsr-regexp-both)
(setq to (cl-etypecase to ('active org-tsr-regexp)
(string (ts-parse-fill 'end to)) ('inactive org-ql-tsr-regexp-inactive)))))
(number (->> (ts-now) ,query))))
(ts-adjust 'day to)
(ts-apply :hour 23 :minute 59 :second 59)))
(ts to))))
;; NOTE: The macro must expand to the actual `org-ql--predicate-clocked'
;; function, not another `clocked'.
`(org-ql--predicate-clocked :from ,from :to ,to))
(closed (&key from to on)
(when on
(setq from on
to on))
(when from
(setq from (cl-etypecase from
(string (ts-parse-fill 'begin from))
(number (->> (ts-now)
(ts-adjust 'day from)
(ts-apply :hour 0 :minute 0 :second 0)))
(ts from))))
(when to
(setq to (cl-etypecase to
(string (ts-parse-fill 'end to))
(number (->> (ts-now)
(ts-adjust 'day to)
(ts-apply :hour 23 :minute 59 :second 59)))
(ts to))))
;; NOTE: The macro must expand to the actual `org-ql--predicate-closed'
;; function, not another `closed'.
`(org-ql--predicate-closed :from ,from :to ,to))
(deadline (&key from to on)
(when on
(setq from on
to on))
(when from
(setq from (cl-etypecase from
(string (ts-parse-fill 'begin from))
(number (->> (ts-now)
(ts-adjust 'day from)
(ts-apply :hour 0 :minute 0 :second 0)))
(ts from))))
(when to
(setq to (cl-etypecase to
(string (ts-parse-fill 'end to))
(number (->> (ts-now)
(ts-adjust 'day to)
(ts-apply :hour 23 :minute 59 :second 59)))
(ts to))))
;; NOTE: The macro must expand to the actual `org-ql--predicate-deadline'
;; function, not another `deadline'.
`(org-ql--predicate-deadline :from ,from :to ,to))
(planning (&key from to on)
(when on
(setq from on
to on))
(when from
(setq from (cl-etypecase from
(string (ts-parse-fill 'begin from))
(number (->> (ts-now)
(ts-adjust 'day from)
(ts-apply :hour 0 :minute 0 :second 0)))
(ts from))))
(when to
(setq to (cl-etypecase to
(string (ts-parse-fill 'end to))
(number (->> (ts-now)
(ts-adjust 'day to)
(ts-apply :hour 23 :minute 59 :second 59)))
(ts to))))
;; NOTE: The macro must expand to the actual `org-ql--predicate-planning'
;; function, not another `planning'.
`(org-ql--predicate-planning :from ,from :to ,to))
(scheduled (&key from to on)
(when on
(setq from on
to on))
(when from
(setq from (cl-etypecase from
(string (ts-parse-fill 'begin from))
(number (->> (ts-now)
(ts-adjust 'day from)
(ts-apply :hour 0 :minute 0 :second 0)))
(ts from))))
(when to
(setq to (cl-etypecase to
(string (ts-parse-fill 'end to))
(number (->> (ts-now)
(ts-adjust 'day to)
(ts-apply :hour 23 :minute 59 :second 59)))
(ts to))))
;; NOTE: The macro must expand to the actual `org-ql--predicate-scheduled'
;; function, not another `scheduled'.
`(org-ql--predicate-scheduled :from ,from :to ,to))
(ts (&key from to on (type 'both))
(when on
(setq from on
to on))
(when from
(setq from (cl-etypecase from
(string (ts-parse-fill 'begin from))
(number (->> (ts-now)
(ts-adjust 'day from)
(ts-apply :hour 0 :minute 0 :second 0)))
(ts from))))
(when to
(setq to (cl-etypecase to
(string (ts-parse-fill 'end to))
(number (->> (ts-now)
(ts-adjust 'day to)
(ts-apply :hour 23 :minute 59 :second 59)))
(ts to))))
;; NOTE: The macro must expand to the actual `org-ql--predicate-ts'
;; function, not another `ts'.
`(org-ql--predicate-ts :from ,from :to ,to
:regexp ,(pcase type
('both org-tsr-regexp-both)
('active org-tsr-regexp)
('inactive org-ql-tsr-regexp-inactive)))))
(cl-symbol-macrolet ((today org-ql--today) ; Necessary because of byte-compiling the lambda
(= #'=)
(< #'<)
(> #'>)
(<= #'<=)
(>= #'>=))
,query))))))
(defun org-ql--query-preamble (query) (defun org-ql--query-preamble (query)
"Return (QUERY PREAMBLE) for QUERY. "Return (QUERY PREAMBLE) for QUERY.

View file

@ -270,18 +270,33 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((clocked :from "2017-07-06")) (org-ql-expect ((clocked :from "2017-07-06"))
nil)) nil))
(org-ql-it ":from today"
(org-ql-then
(org-ql-expect ((clocked :from today))
'("Learn universal sign language"))))
(org-ql-it ":to a timestamp" (org-ql-it ":to a timestamp"
(org-ql-expect ((clocked :to "2017-07-05")) (org-ql-expect ((clocked :to "2017-07-05"))
'("Learn universal sign language")) '("Learn universal sign language"))
(org-ql-expect ((clocked :to "2017-07-04")) (org-ql-expect ((clocked :to "2017-07-04"))
nil)) nil))
(org-ql-it ":to today"
(org-ql-then
(org-ql-expect ((clocked :to today))
'("Learn universal sign language"))))
(org-ql-it ":on a date" (org-ql-it ":on a date"
(org-ql-expect ((clocked :on "2017-07-05")) (org-ql-expect ((clocked :on "2017-07-05"))
'("Learn universal sign language")) '("Learn universal sign language"))
(org-ql-expect ((clocked :on "2018-12-02")) (org-ql-expect ((clocked :on "2018-12-02"))
nil)) nil))
(org-ql-it ":on today"
(org-ql-then
(org-ql-expect ((clocked :on today))
'("Learn universal sign language"))))
(org-ql-it "within a range (:from and :to)" (org-ql-it "within a range (:from and :to)"
(org-ql-expect ((clocked :from "2017-07-04" :to "2018-12-11")) (org-ql-expect ((clocked :from "2017-07-04" :to "2018-12-11"))
'("Learn universal sign language")) '("Learn universal sign language"))
@ -304,6 +319,9 @@ RESULTS should be a list of strings as returned by
(org-ql-it ":on" (org-ql-it ":on"
(org-ql-expect ((closed :on "2017-07-05")) (org-ql-expect ((closed :on "2017-07-05"))
'("Learn universal sign language")) '("Learn universal sign language"))
(org-ql-then
(org-ql-expect ((closed :on today))
'("Learn universal sign language")))
(org-ql-expect ((closed :on "2019-06-09")) (org-ql-expect ((closed :on "2019-06-09"))
nil)) nil))
@ -312,6 +330,9 @@ RESULTS should be a list of strings as returned by
'("Learn universal sign language")) '("Learn universal sign language"))
(org-ql-expect ((closed :from "2017-07-05")) (org-ql-expect ((closed :from "2017-07-05"))
'("Learn universal sign language")) '("Learn universal sign language"))
(org-ql-then
(org-ql-expect ((closed :from today))
'("Learn universal sign language")))
(org-ql-expect ((closed :from "2017-07-06")) (org-ql-expect ((closed :from "2017-07-06"))
nil)) nil))
@ -320,6 +341,9 @@ RESULTS should be a list of strings as returned by
nil) nil)
(org-ql-expect ((closed :to "2017-07-05")) (org-ql-expect ((closed :to "2017-07-05"))
'("Learn universal sign language")) '("Learn universal sign language"))
(org-ql-then
(org-ql-expect ((closed :to today))
'("Learn universal sign language")))
(org-ql-expect ((closed :to "2017-07-06")) (org-ql-expect ((closed :to "2017-07-06"))
'("Learn universal sign language")))) '("Learn universal sign language"))))
@ -342,6 +366,9 @@ RESULTS should be a list of strings as returned by
(org-ql-it ":on" (org-ql-it ":on"
(org-ql-expect ((deadline :on "2017-07-05")) (org-ql-expect ((deadline :on "2017-07-05"))
'("/r/emacs")) '("/r/emacs"))
(org-ql-then
(org-ql-expect ((deadline :on today))
'("/r/emacs")))
(org-ql-expect ((deadline :on "2019-06-09")) (org-ql-expect ((deadline :on "2019-06-09"))
nil)) nil))
@ -354,7 +381,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((deadline :from "2017-07-06")) (org-ql-expect ((deadline :from "2017-07-06"))
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease"))
(org-ql-expect ((deadline :from "2018-07-06")) (org-ql-expect ((deadline :from "2018-07-06"))
nil)) nil)
(org-ql-then
(org-ql-expect ((deadline :from today))
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs"))))
(org-ql-it ":to" (org-ql-it ":to"
(org-ql-expect ((deadline :to "2017-07-04")) (org-ql-expect ((deadline :to "2017-07-04"))
@ -362,7 +392,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((deadline :to "2017-07-05")) (org-ql-expect ((deadline :to "2017-07-05"))
'("/r/emacs")) '("/r/emacs"))
(org-ql-expect ((deadline :to "2018-07-06")) (org-ql-expect ((deadline :to "2018-07-06"))
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")))) '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs"))
(org-ql-then
(org-ql-expect ((deadline :to today))
'("/r/emacs")))))
(org-ql-it "(done)" (org-ql-it "(done)"
(org-ql-expect ((done)) (org-ql-expect ((done))
@ -387,7 +420,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((planning :on "2017-07-05")) (org-ql-expect ((planning :on "2017-07-05"))
'("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((planning :on "2019-06-09")) (org-ql-expect ((planning :on "2019-06-09"))
nil)) nil)
(org-ql-then
(org-ql-expect ((planning :on today))
'("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":from" (org-ql-it ":from"
(org-ql-expect ((planning :from "2017-07-04")) (org-ql-expect ((planning :from "2017-07-04"))
@ -395,7 +431,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((planning :from "2017-07-05")) (org-ql-expect ((planning :from "2017-07-05"))
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((planning :from "2017-07-06")) (org-ql-expect ((planning :from "2017-07-06"))
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease"))) '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease"))
(org-ql-then
(org-ql-expect ((planning :from today))
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":to" (org-ql-it ":to"
(org-ql-expect ((planning :to "2017-07-04")) (org-ql-expect ((planning :to "2017-07-04"))
@ -403,7 +442,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((planning :to "2017-07-05")) (org-ql-expect ((planning :to "2017-07-05"))
'("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((planning :to "2018-07-06")) (org-ql-expect ((planning :to "2018-07-06"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-then
(org-ql-expect ((planning :to today))
'("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))))
(describe "(property)" (describe "(property)"
@ -457,7 +499,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((scheduled :on "2017-07-05")) (org-ql-expect ((scheduled :on "2017-07-05"))
'("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((scheduled :on "2019-06-09")) (org-ql-expect ((scheduled :on "2019-06-09"))
nil)) nil)
(org-ql-then
(org-ql-expect ((scheduled :on today))
'("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":from" (org-ql-it ":from"
(org-ql-expect ((scheduled :from "2017-07-04")) (org-ql-expect ((scheduled :from "2017-07-04"))
@ -465,7 +510,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((scheduled :from "2017-07-05")) (org-ql-expect ((scheduled :from "2017-07-05"))
'("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((scheduled :from "2017-07-06")) (org-ql-expect ((scheduled :from "2017-07-06"))
nil)) nil)
(org-ql-then
(org-ql-expect ((scheduled :from today))
'("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":to" (org-ql-it ":to"
(org-ql-expect ((scheduled :to "2017-07-04")) (org-ql-expect ((scheduled :to "2017-07-04"))
@ -473,7 +521,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((scheduled :to "2017-07-05")) (org-ql-expect ((scheduled :to "2017-07-05"))
'("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((scheduled :to "2018-07-06")) (org-ql-expect ((scheduled :to "2018-07-06"))
'("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-then
(org-ql-expect ((scheduled :to today))
'("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")))))
(describe "(todo)" (describe "(todo)"
@ -523,11 +574,13 @@ RESULTS should be a list of strings as returned by
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))
(org-ql-it ":from a timestamp" (org-ql-it ":from a timestamp"
;; TODO: Figure out why these take longer than the other (ts) tests.
(org-ql-expect ((ts :from "2017-07-08" :type active)) (org-ql-expect ((ts :from "2017-07-08" :type active))
'("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) '("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease"))
(org-ql-expect ((ts :from "2019-06-08" :type active)) (org-ql-expect ((ts :from "2019-06-08" :type active))
nil)) nil)
(org-ql-then
(org-ql-expect ((ts :from today))
'("Test data" "Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":from a number of days" (org-ql-it ":from a number of days"
(org-ql-then (org-ql-then
@ -538,7 +591,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :to "2019-06-10" :type active)) (org-ql-expect ((ts :to "2019-06-10" :type active))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((ts :to "2017-07-04" :type active)) (org-ql-expect ((ts :to "2017-07-04" :type active))
'("Skype with president of Antarctica"))) '("Skype with president of Antarctica"))
(org-ql-then
(org-ql-expect ((ts :to today))
'("Test data" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":to a number of days" (org-ql-it ":to a number of days"
(org-ql-then (org-ql-then
@ -549,7 +605,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :on "2017-07-05" :type active)) (org-ql-expect ((ts :on "2017-07-05" :type active))
'("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((ts :on "2019-06-09" :type active)) (org-ql-expect ((ts :on "2019-06-09" :type active))
nil)) nil)
(org-ql-then
(org-ql-expect ((ts :on today))
'("Test data" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":on a number of days" (org-ql-it ":on a number of days"
(org-ql-then (org-ql-then
@ -566,7 +625,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :from "2017-07-06" :type inactive)) (org-ql-expect ((ts :from "2017-07-06" :type inactive))
'("Visit the moon" "Rewrite Emacs in Common Lisp")) '("Visit the moon" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((ts :from "2019-06-08" :type inactive)) (org-ql-expect ((ts :from "2019-06-08" :type inactive))
nil)) nil)
(org-ql-then
(org-ql-expect ((ts-inactive :from today))
'("Test data" "Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":from a number of days" (org-ql-it ":from a number of days"
(org-ql-then (org-ql-then
@ -577,7 +639,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :to "2019-06-10" :type inactive)) (org-ql-expect ((ts :to "2019-06-10" :type inactive))
'("Test data" "Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")) '("Test data" "Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((ts :to "2017-07-04" :type inactive)) (org-ql-expect ((ts :to "2017-07-04" :type inactive))
'nil)) 'nil)
(org-ql-then
(org-ql-expect ((ts-inactive :to today))
'("Test data" "Learn universal sign language"))))
(org-ql-it ":to a number of days" (org-ql-it ":to a number of days"
(org-ql-then (org-ql-then
@ -588,7 +653,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :on "2017-07-05" :type inactive)) (org-ql-expect ((ts :on "2017-07-05" :type inactive))
'("Test data" "Learn universal sign language")) '("Test data" "Learn universal sign language"))
(org-ql-expect ((ts :on "2019-06-09" :type inactive)) (org-ql-expect ((ts :on "2019-06-09" :type inactive))
nil)) nil)
(org-ql-then
(org-ql-expect ((ts-inactive :on today))
'("Test data" "Learn universal sign language"))))
(org-ql-it ":on a number of days" (org-ql-it ":on a number of days"
(org-ql-then (org-ql-then
@ -604,7 +672,6 @@ RESULTS should be a list of strings as returned by
'("Test data" "Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) '("Test data" "Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))
(org-ql-it ":from a timestamp" (org-ql-it ":from a timestamp"
;; TODO: Figure out why these take longer than the other (ts) tests.
(org-ql-expect ((ts :from "2017-07-05")) (org-ql-expect ((ts :from "2017-07-05"))
'("Test data" "Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) '("Test data" "Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((ts :from "2017-07-05" :type both)) (org-ql-expect ((ts :from "2017-07-05" :type both))
@ -612,7 +679,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :from "2019-06-08")) (org-ql-expect ((ts :from "2019-06-08"))
nil) nil)
(org-ql-expect ((ts :from "2019-06-08" :type both)) (org-ql-expect ((ts :from "2019-06-08" :type both))
nil)) nil)
(org-ql-then
(org-ql-expect ((ts :from today))
'("Test data" "Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":from a number of days" (org-ql-it ":from a number of days"
(org-ql-then (org-ql-then
@ -627,7 +697,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :to "2017-07-04")) (org-ql-expect ((ts :to "2017-07-04"))
'("Skype with president of Antarctica")) '("Skype with president of Antarctica"))
(org-ql-expect ((ts :to "2017-07-04" :type both)) (org-ql-expect ((ts :to "2017-07-04" :type both))
'("Skype with president of Antarctica"))) '("Skype with president of Antarctica"))
(org-ql-then
(org-ql-expect ((ts :to today))
'("Test data" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":to a number of days" (org-ql-it ":to a number of days"
(org-ql-then (org-ql-then
@ -642,7 +715,10 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((ts :on "2019-06-09")) (org-ql-expect ((ts :on "2019-06-09"))
nil) nil)
(org-ql-expect ((ts :on "2019-06-09" :type both)) (org-ql-expect ((ts :on "2019-06-09" :type both))
nil)) nil)
(org-ql-then
(org-ql-expect ((ts :on today))
'("Test data" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":on a number of days" (org-ql-it ":on a number of days"
(org-ql-then (org-ql-then