Change: (org-ql) Declare macro obsolete

This commit is contained in:
Adam Porter 2020-11-22 17:33:46 -06:00
parent 56a08208e5
commit 90f712aba9
4 changed files with 252 additions and 242 deletions

View file

@ -478,6 +478,9 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
*Internal* *Internal*
+ When formatting entries for Org QL View buffers, use internal function for retrieving heading tags. This improves speed by using our cache, and it removes the need for a compatibility alias for Org versions before 9.3. + When formatting entries for Org QL View buffers, use internal function for retrieving heading tags. This improves speed by using our cache, and it removes the need for a compatibility alias for Org versions before 9.3.
*Deprecated*
+ Macro =org-ql= is marked obsolete. It will be removed in v0.7. Functions =org-ql-select= and =org-ql-query= should be used instead. (The macro serves only to confuse with regard to quoting arguments.)
*Acknowledgments* *Acknowledgments*
+ [[https://github.com/tpeacock19][tpeacock19]] for extensive help testing new features in this version. + [[https://github.com/tpeacock19][tpeacock19]] for extensive help testing new features in this version.

View file

@ -184,12 +184,12 @@ match."
(push (list :name ',pred-name :aliases ',aliases :fn ',fn-name :docstring ,docstring :args ',args) org-ql-predicates)) (push (list :name ',pred-name :aliases ',aliases :fn ',fn-name :docstring ,docstring :args ',args) org-ql-predicates))
(cl-defun ,fn-name ,args ,docstring ,@body)))) (cl-defun ,fn-name ,args ,docstring ,@body))))
;; TODO: Mark as obsolete/deprecated.
;;;###autoload ;;;###autoload
(cl-defmacro org-ql (buffers-or-files query &key sort narrow action) (cl-defmacro org-ql (buffers-or-files query &key sort narrow action)
"Expands into a call to `org-ql-select' with the same arguments. "Expands into a call to `org-ql-select' with the same arguments.
For convenience, arguments should be unquoted." For convenience, arguments should be unquoted."
(declare (indent defun)) (declare (indent defun)
(obsolete "Please use functions `org-ql-select' or `org-ql-query' instead" "org-ql 0.5"))
`(org-ql-select ,buffers-or-files `(org-ql-select ,buffers-or-files
',query ',query
:action ',action :action ',action

View file

@ -882,6 +882,12 @@ File: README.info, Node: 05-pre, Next: 049, Up: Changelog
our cache, and it removes the need for a compatibility alias for our cache, and it removes the need for a compatibility alias for
Org versions before 9.3. Org versions before 9.3.
*Deprecated*
• Macro org-ql is marked obsolete. It will be removed in v0.7.
Functions org-ql-select and org-ql-query should be used instead.
(The macro serves only to confuse with regard to quoting
arguments.)
*Acknowledgments* *Acknowledgments*
• tpeacock19 (https://github.com/tpeacock19) for extensive help • tpeacock19 (https://github.com/tpeacock19) for extensive help
testing new features in this version. testing new features in this version.
@ -1357,28 +1363,28 @@ Node: Links29556
Node: Tips30243 Node: Tips30243
Node: Changelog30561 Node: Changelog30561
Node: 05-pre31245 Node: 05-pre31245
Node: 04932484 Node: 04932719
Node: 04832762 Node: 04832997
Node: 04733109 Node: 04733344
Node: 04633504 Node: 04633739
Node: 04533904 Node: 04534139
Node: 04434263 Node: 04434498
Node: 04334620 Node: 04334855
Node: 04234815 Node: 04235050
Node: 04134974 Node: 04135209
Node: 0435215 Node: 0435450
Node: 03239148 Node: 03239383
Node: 03139527 Node: 03139762
Node: 0339724 Node: 0339959
Node: 02342699 Node: 02342934
Node: 02242927 Node: 02243162
Node: 02143195 Node: 02143430
Node: 0243394 Node: 0243629
Node: 0147429 Node: 0147664
Node: Notes47530 Node: Notes47765
Node: Comparison with Org Agenda searches47692 Node: Comparison with Org Agenda searches47927
Node: org-sidebar48564 Node: org-sidebar48799
Node: License48843 Node: License49078
 
End Tag Table End Tag Table

View file

@ -54,14 +54,14 @@ Set at runtime by test suite.")
(_ nil))) (_ nil)))
(result (pcase sexp (result (pcase sexp
(`(org-ql-expect ,args) (`(org-ql-expect ,args)
(org-ql-test--format-result--ql `(org-ql org-ql-test-buffer (org-ql-test--format-result--ql `(org-ql-select org-ql-test-buffer
,@args ,@args
:action (org-ql-test-org-get-heading)))) :action (org-ql-test-org-get-heading))))
(`(org-ql-expect ,args ,_ :buffer ,buffer) (`(org-ql-expect ,args ,_ :buffer ,buffer)
(org-ql-test--format-result--ql `(org-ql ,buffer (org-ql-test--format-result--ql `(org-ql-select ,buffer
,@args ,@args
:action (org-ql-test-org-get-heading)))) :action (org-ql-test-org-get-heading))))
(`(org-ql . _) (org-ql-test--format-result--ql sexp)) (`(org-ql-select . _) (org-ql-test--format-result--ql sexp))
(`(org-ql--query-preamble . _) (org-ql-test--format-result--query-preamble sexp)) (`(org-ql--query-preamble . _) (org-ql-test--format-result--query-preamble sexp))
(`(org-ql--pre-process-query . _) (format "'%S" (eval sexp))) (`(org-ql--pre-process-query . _) (format "'%S" (eval sexp)))
(_ nil)))) (_ nil))))
@ -92,7 +92,7 @@ Set at runtime by test suite.")
(interactive) (interactive)
(if-let* ((sexp (elisp--preceding-sexp)) (if-let* ((sexp (elisp--preceding-sexp))
(sexp (pcase sexp (sexp (pcase sexp
(`(org-ql . ,_) (setf (car sexp) 'org-ql-agenda)) (`(org-ql-select . ,_) (setf (car sexp) 'org-ql-agenda))
(`(org-ql-expect ,ql-args . ,_) (setf sexp `(org-ql-search org-ql-test-buffer (`(org-ql-expect ,ql-args . ,_) (setf sexp `(org-ql-search org-ql-test-buffer
',@ql-args))) ',@ql-args)))
(_ nil)))) (_ nil))))
@ -131,9 +131,9 @@ Based on Buttercup macro `it'."
RESULTS should be a list of strings as returned by RESULTS should be a list of strings as returned by
`org-ql-test-org-get-heading'." `org-ql-test-org-get-heading'."
(declare (indent defun)) (declare (indent defun))
`(expect (org-ql ,buffer `(expect (org-ql-select ,buffer
,@ql-args ,@ql-args
:action (org-ql-test-org-get-heading)) :action '(org-ql-test-org-get-heading))
:to-equal ,results)) :to-equal ,results))
(defmacro org-ql-then (&rest body) (defmacro org-ql-then (&rest body)
@ -201,6 +201,7 @@ RESULTS should be a list of strings as returned by
(describe "Query functions/macros" (describe "Query functions/macros"
(it "org-ql" (it "org-ql"
;; FIXME: Remove when org-ql macro is removed.
(expect (length (org-ql org-ql-test-buffer (expect (length (org-ql org-ql-test-buffer
(category) (category)
:sort deadline)) :sort deadline))
@ -422,423 +423,423 @@ RESULTS should be a list of strings as returned by
(describe "(ancestors)" (describe "(ancestors)"
(org-ql-it "without sub-query" (org-ql-it "without sub-query"
(org-ql-expect ((ancestors)) (org-ql-expect ('(ancestors))
'("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with sub-query" (org-ql-it "with sub-query"
(org-ql-expect ((ancestors (heading "universe"))) (org-ql-expect ('(ancestors (heading "universe")))
'("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language"))))
(describe "(parent)" (describe "(parent)"
(org-ql-it "without sub-query" (org-ql-it "without sub-query"
(org-ql-expect ((parent)) (org-ql-expect ('(parent))
'("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with sub-query" (org-ql-it "with sub-query"
(org-ql-expect ((parent (and (todo) (priority "A")))) (org-ql-expect ('(parent (and (todo) (priority "A"))))
'("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language"))))
(describe "(category)" (describe "(category)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(expect (length (org-ql org-ql-test-buffer (expect (length (org-ql-select org-ql-test-buffer
(category))) '(category)))
:to-equal org-ql-test-num-headings)) :to-equal org-ql-test-num-headings))
(org-ql-it "with a category" (org-ql-it "with a category"
(org-ql-expect ((category "ambition")) (org-ql-expect ('(category "ambition"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language"))))
(describe "(children)" (describe "(children)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((children)) (org-ql-expect ('(children))
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas"))) '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas")))
(org-ql-it "with sub-query" (org-ql-it "with sub-query"
(org-ql-expect ((children (todo "CHECK"))) (org-ql-expect ('(children (todo "CHECK")))
'("Recurring"))) '("Recurring")))
(org-ql-it "with grandchildren query" (org-ql-it "with grandchildren query"
;; It's really cool how this works. It's so simple. ;; It's really cool how this works. It's so simple.
(org-ql-expect ((children (children "moon"))) (org-ql-expect ('(children (children "moon")))
'("Take over the universe")))) '("Take over the universe"))))
(describe "(descendants)" (describe "(descendants)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((descendants)) (org-ql-expect ('(descendants))
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas"))) '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas")))
(org-ql-it "with sub-query" (org-ql-it "with sub-query"
(org-ql-expect ((descendants (todo "CHECK"))) (org-ql-expect ('(descendants (todo "CHECK")))
'("Recurring"))) '("Recurring")))
(org-ql-it "with granddescendants query" (org-ql-it "with granddescendants query"
(org-ql-expect ((descendants (descendants "moon"))) (org-ql-expect ('(descendants (descendants "moon")))
'("Take over the universe"))) '("Take over the universe")))
(org-ql-it "with query that should not match parent" (org-ql-it "with query that should not match parent"
;; This test would fail if the `descendants' predicate did not properly exclude ;; This test would fail if the `descendants' predicate did not properly exclude
;; the parent heading by narrowing the buffer to begin at the first child. ;; the parent heading by narrowing the buffer to begin at the first child.
(org-ql-expect ((and (descendants (todo "WAITING")) (org-ql-expect ('(and (descendants (todo "WAITING"))
(not (descendants (todo "TODO" "NEXT"))))) (not (descendants (todo "TODO" "NEXT")))))
'("Take over the moon")))) '("Take over the moon"))))
(describe "(clocked)" (describe "(clocked)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((clocked)) (org-ql-expect ('(clocked))
'("Learn universal sign language"))) '("Learn universal sign language")))
(org-ql-it "with a number" (org-ql-it "with a number"
(org-ql-then (org-ql-then
(org-ql-expect ((clocked 10)) (org-ql-expect ('(clocked 10))
'("Learn universal sign language")))) '("Learn universal sign language"))))
(org-ql-it ":from a timestamp" (org-ql-it ":from a timestamp"
(org-ql-expect ((clocked :from "2017-07-05")) (org-ql-expect ('(clocked :from "2017-07-05"))
'("Learn universal sign language")) '("Learn universal sign language"))
(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-it ":from today"
(org-ql-then (org-ql-then
(org-ql-expect ((clocked :from today)) (org-ql-expect ('(clocked :from today))
'("Learn universal sign language")))) '("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-it ":to today"
(org-ql-then (org-ql-then
(org-ql-expect ((clocked :to today)) (org-ql-expect ('(clocked :to today))
'("Learn universal sign language")))) '("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-it ":on today"
(org-ql-then (org-ql-then
(org-ql-expect ((clocked :on today)) (org-ql-expect ('(clocked :on today))
'("Learn universal sign language")))) '("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"))
(org-ql-expect ((clocked :from "2017-07-06" :to "2018-12-11")) (org-ql-expect ('(clocked :from "2017-07-06" :to "2018-12-11"))
nil) nil)
(org-ql-expect ((clocked :from "2017-07-01" :to "2017-07-04")) (org-ql-expect ('(clocked :from "2017-07-01" :to "2017-07-04"))
nil))) nil)))
(describe "(closed)" (describe "(closed)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((closed)) (org-ql-expect ('(closed))
'("Learn universal sign language"))) '("Learn universal sign language")))
(org-ql-it "with a number" (org-ql-it "with a number"
(org-ql-then (org-ql-then
(org-ql-expect ((closed 10)) (org-ql-expect ('(closed 10))
'("Learn universal sign language")))) '("Learn universal sign language"))))
(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-then
(org-ql-expect ((closed :on today)) (org-ql-expect ('(closed :on today))
'("Learn universal sign language"))) '("Learn universal sign language")))
(org-ql-expect ((closed :on "2019-06-09")) (org-ql-expect ('(closed :on "2019-06-09"))
nil)) nil))
(org-ql-it ":from" (org-ql-it ":from"
(org-ql-expect ((closed :from "2017-07-04")) (org-ql-expect ('(closed :from "2017-07-04"))
'("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-then
(org-ql-expect ((closed :from today)) (org-ql-expect ('(closed :from today))
'("Learn universal sign language"))) '("Learn universal sign language")))
(org-ql-expect ((closed :from "2017-07-06")) (org-ql-expect ('(closed :from "2017-07-06"))
nil)) nil))
(org-ql-it ":to" (org-ql-it ":to"
(org-ql-expect ((closed :to "2017-07-04")) (org-ql-expect ('(closed :to "2017-07-04"))
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-then
(org-ql-expect ((closed :to today)) (org-ql-expect ('(closed :to today))
'("Learn universal sign language"))) '("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"))))
(describe "(deadline)" (describe "(deadline)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((deadline)) (org-ql-expect ('(deadline))
'("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-it "auto" (org-ql-it "auto"
(org-ql-then (org-ql-then
(org-ql-expect ((deadline auto)) (org-ql-expect ('(deadline auto))
'("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-it "with a number" (org-ql-it "with a number"
(org-ql-then (org-ql-then
(org-ql-expect ((deadline 2)) (org-ql-expect ('(deadline 2))
'("Take over the world" "/r/emacs")))) '("Take over the world" "/r/emacs"))))
(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-then
(org-ql-expect ((deadline :on today)) (org-ql-expect ('(deadline :on today))
'("/r/emacs"))) '("/r/emacs")))
(org-ql-expect ((deadline :on "2019-06-09")) (org-ql-expect ('(deadline :on "2019-06-09"))
nil)) nil))
(org-ql-it ":from" (org-ql-it ":from"
(org-ql-expect ((deadline :from "2017-07-04")) (org-ql-expect ('(deadline :from "2017-07-04"))
'("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-expect ((deadline :from "2017-07-05")) (org-ql-expect ('(deadline :from "2017-07-05"))
'("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-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-then
(org-ql-expect ((deadline :from today)) (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")))) '("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"))
nil) nil)
(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-then
(org-ql-expect ((deadline :to today)) (org-ql-expect ('(deadline :to today))
'("/r/emacs"))))) '("/r/emacs")))))
(org-ql-it "(done)" (org-ql-it "(done)"
(org-ql-expect ((done)) (org-ql-expect ('(done))
'("Learn universal sign language"))) '("Learn universal sign language")))
(org-ql-it "(habit)" (org-ql-it "(habit)"
(org-ql-expect ((habit)) (org-ql-expect ('(habit))
'("Practice leaping tall buildings in a single bound"))) '("Practice leaping tall buildings in a single bound")))
(describe "(heading)" (describe "(heading)"
(org-ql-it "with one argument" (org-ql-it "with one argument"
(org-ql-expect ((heading "world")) (org-ql-expect ('(heading "world"))
;; NOTE: This--correctly--does not match the "Skype with president of ;; NOTE: This--correctly--does not match the "Skype with president of
;; Antarctica" heading, which has the tag ":world:" in its heading line. ;; Antarctica" heading, which has the tag ":world:" in its heading line.
'("Take over the world"))) '("Take over the world")))
(org-ql-it "with two arguments" (org-ql-it "with two arguments"
(org-ql-expect ((heading "Take over" "world")) (org-ql-expect ('(heading "Take over" "world"))
'("Take over the world")))) '("Take over the world"))))
(describe "(link)" (describe "(link)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((link)) (org-ql-expect ('(link))
'("/r/emacs"))) '("/r/emacs")))
(org-ql-it "with description-or-target" (org-ql-it "with description-or-target"
(org-ql-expect ((link "emacs")) (org-ql-expect ('(link "emacs"))
'("/r/emacs"))) '("/r/emacs")))
(org-ql-it "with :description" (org-ql-it "with :description"
(org-ql-expect ((link :description "emacs")) (org-ql-expect ('(link :description "emacs"))
'("/r/emacs"))) '("/r/emacs")))
(org-ql-it "with :target" (org-ql-it "with :target"
(org-ql-expect ((link :target "reddit.com")) (org-ql-expect ('(link :target "reddit.com"))
'("/r/emacs"))) '("/r/emacs")))
(org-ql-it "with :description and :target" (org-ql-it "with :description and :target"
(org-ql-expect ((link :description "emacs" :target "reddit.com")) (org-ql-expect ('(link :description "emacs" :target "reddit.com"))
'("/r/emacs")))) '("/r/emacs"))))
(describe "(outline-path)" (describe "(outline-path)"
(org-ql-it "with one argument" (org-ql-it "with one argument"
(org-ql-expect ((outline-path "symphony")) (org-ql-expect ('(outline-path "symphony"))
'("Write a symphony"))) '("Write a symphony")))
(org-ql-it "with two arguments" (org-ql-it "with two arguments"
(org-ql-expect ((outline-path "idea" "symphony")) (org-ql-expect ('(outline-path "idea" "symphony"))
'("Write a symphony")))) '("Write a symphony"))))
(describe "(outline-path-segment)" (describe "(outline-path-segment)"
(org-ql-it "with one argument" (org-ql-it "with one argument"
(org-ql-expect ((outline-path-segment "symphony")) (org-ql-expect ('(outline-path-segment "symphony"))
'("Write a symphony"))) '("Write a symphony")))
(org-ql-it "with a contiguous segment" (org-ql-it "with a contiguous segment"
(org-ql-expect ((outline-path-segment "idea" "symphony")) (org-ql-expect ('(outline-path-segment "idea" "symphony"))
'("Write a symphony"))) '("Write a symphony")))
(org-ql-it "with a non-contiguous segment" (org-ql-it "with a non-contiguous segment"
(org-ql-expect ((outline-path-segment "data" "symphony")) (org-ql-expect ('(outline-path-segment "data" "symphony"))
nil))) nil)))
(describe "(path)" (describe "(path)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((path)) (org-ql-expect ('(path))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with one argument" (org-ql-it "with one argument"
(org-ql-expect ((path "data")) (org-ql-expect ('(path "data"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with two matching arguments" (org-ql-it "with two matching arguments"
(org-ql-expect ((path "data" "tests")) (org-ql-expect ('(path "data" "tests"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with two arguments, one matching" (org-ql-it "with two arguments, one matching"
(org-ql-expect ((path "data" "nope")) (org-ql-expect ('(path "data" "nope"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))))
(describe "(planning)" (describe "(planning)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((planning)) (org-ql-expect ('(planning))
'("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-it "with a number" (org-ql-it "with a number"
(org-ql-then (org-ql-then
(org-ql-expect ((planning 2)) (org-ql-expect ('(planning 2))
'("Take over the world" "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")))) '("Take over the world" "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 ":on" (org-ql-it ":on"
(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-then
(org-ql-expect ((planning :on today)) (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")))) '("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"))
'("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-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-then
(org-ql-expect ((planning :from today)) (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")))) '("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"))
'("Skype with president of Antarctica")) '("Skype with president of Antarctica"))
(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-then
(org-ql-expect ((planning :to today)) (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"))))) '("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 "(priority)" (describe "(priority)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((priority)) (org-ql-expect ('(priority))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor")))
(org-ql-it "with a priority" (org-ql-it "with a priority"
(org-ql-expect ((priority "A")) (org-ql-expect ('(priority "A"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease")))
(org-ql-it "= a priority" (org-ql-it "= a priority"
(org-ql-expect ((priority = "A")) (org-ql-expect ('(priority = "A"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease")))
(org-ql-it "< a priority" (org-ql-it "< a priority"
(org-ql-expect ((priority < "B")) (org-ql-expect ('(priority < "B"))
'("Take over the moon" "Get haircut"))) '("Take over the moon" "Get haircut")))
(org-ql-it "<= a priority" (org-ql-it "<= a priority"
(org-ql-expect ((priority <= "B")) (org-ql-expect ('(priority <= "B"))
'("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Fix flux capacitor"))) '("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Fix flux capacitor")))
(org-ql-it "> a priority" (org-ql-it "> a priority"
(org-ql-expect ((priority > "B")) (org-ql-expect ('(priority > "B"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease")))
(org-ql-it ">= a priority" (org-ql-it ">= a priority"
(org-ql-expect ((priority >= "B")) (org-ql-expect ('(priority >= "B"))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Renew membership in supervillain club" "Learn universal sign language" "Internet" "Spaceship lease" "Fix flux capacitor")))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Renew membership in supervillain club" "Learn universal sign language" "Internet" "Spaceship lease" "Fix flux capacitor"))))
(describe "(property)" (describe "(property)"
;; MAYBE: Add support for (property) without arguments. ;; MAYBE: Add support for (property) without arguments.
;; (org-ql-it "without arguments" ;; (org-ql-it "without arguments"
;; (org-ql-expect ((property)))) ;; (org-ql-expect ('(property))))
(org-ql-it "with a property" (org-ql-it "with a property"
(org-ql-expect ((property "agenda-group")) (org-ql-expect ('(property "agenda-group"))
'("Take over the universe" "Spaceship lease" "Recurring" "Write a symphony"))) '("Take over the universe" "Spaceship lease" "Recurring" "Write a symphony")))
(org-ql-it "with a property and a value" (org-ql-it "with a property and a value"
(org-ql-expect ((property "agenda-group" "plans")) (org-ql-expect ('(property "agenda-group" "plans"))
'("Take over the universe" "Write a symphony")))) '("Take over the universe" "Write a symphony"))))
(describe "(regexp)" (describe "(regexp)"
(org-ql-it "with 1 argument" (org-ql-it "with 1 argument"
(org-ql-expect ((regexp "Take over") (org-ql-expect ('(regexp "Take over")
:sort todo) :sort 'todo)
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))
(org-ql-it "with 2 arguments" (org-ql-it "with 2 arguments"
(org-ql-expect ((regexp "Take over" "universe") (org-ql-expect ('(regexp "Take over" "universe")
:sort todo) :sort 'todo)
'("Take over the universe"))) '("Take over the universe")))
(org-ql-it "with a plain string" (org-ql-it "with a plain string"
(org-ql-expect ("Take over" (org-ql-expect ("Take over"
:sort todo) :sort 'todo)
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))
(org-ql-it "with two plain strings in an OR" (org-ql-it "with two plain strings in an OR"
(org-ql-expect ((or "Take over" "universe") (org-ql-expect ('(or "Take over" "universe")
:sort todo) :sort 'todo)
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))
(org-ql-it "case-folding predicate with non-case-folding preamble" (org-ql-it "case-folding predicate with non-case-folding preamble"
;; e.g. the (todo) predicate disables case-folding in its preamble, but that ;; e.g. the (todo) predicate disables case-folding in its preamble, but that
;; should not prevent case-folding in this and other predicates (issue #114). ;; should not prevent case-folding in this and other predicates (issue #114).
(org-ql-expect ((and (todo "TODO") (regexp "take over")) (org-ql-expect ('(and (todo "TODO") (regexp "take over"))
:sort todo) :sort 'todo)
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))) '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))))
(describe "(scheduled)" (describe "(scheduled)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((scheduled)) (org-ql-expect ('(scheduled))
'("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-it "with a number" (org-ql-it "with a number"
(org-ql-then (org-ql-then
;; Using -1 is the easiest way to exclude some results but not all for testing this. ;; Using -1 is the easiest way to exclude some results but not all for testing this.
(org-ql-expect ((scheduled -1)) (org-ql-expect ('(scheduled -1))
'("Skype with president of Antarctica")))) '("Skype with president of Antarctica"))))
(org-ql-it ":on" (org-ql-it ":on"
(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-then
(org-ql-expect ((scheduled :on today)) (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")))) '("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"))
'("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 :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-then
(org-ql-expect ((scheduled :from today)) (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")))) '("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"))
'("Skype with president of Antarctica")) '("Skype with president of Antarctica"))
(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-then
(org-ql-expect ((scheduled :to today)) (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"))))) '("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")))))
;; TODO: Test (src) predicate. That will require modifying test data, which will be a ;; TODO: Test (src) predicate. That will require modifying test data, which will be a
@ -847,147 +848,147 @@ RESULTS should be a list of strings as returned by
(describe "(todo)" (describe "(todo)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((todo) (org-ql-expect ('(todo)
:sort todo) :sort 'todo)
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Write a symphony")))
(org-ql-it "with 1 argument" (org-ql-it "with 1 argument"
(org-ql-expect ((todo "WAITING") (org-ql-expect ('(todo "WAITING")
:sort todo) :sort 'todo)
'("Visit the moon"))) '("Visit the moon")))
(org-ql-it "with 2 arguments" (org-ql-it "with 2 arguments"
(org-ql-expect ((todo "WAITING" "SOMEDAY") (org-ql-expect ('(todo "WAITING" "SOMEDAY")
:sort todo) :sort 'todo)
'("Visit the moon" "Rewrite Emacs in Common Lisp" "Write a symphony")))) '("Visit the moon" "Rewrite Emacs in Common Lisp" "Write a symphony"))))
(describe "(tags)" (describe "(tags)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((tags)) (org-ql-expect ('(tags))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Write a symphony")) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Write a symphony"))
(org-ql-expect ((not (tags))) (org-ql-expect ('(not (tags)))
'("Recurring" "Sunrise/sunset" "Ideas"))) '("Recurring" "Sunrise/sunset" "Ideas")))
(org-ql-it "with a tag" (org-ql-it "with a tag"
(org-ql-expect ((tags "Emacs")) (org-ql-expect ('(tags "Emacs"))
'("/r/emacs" "Rewrite Emacs in Common Lisp")) '("/r/emacs" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((not (tags "Emacs"))) (org-ql-expect ('(not (tags "Emacs")))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony")))
(org-ql-it "with 2 tags" (org-ql-it "with 2 tags"
(org-ql-expect ((tags "Emacs" "space")) (org-ql-expect ('(tags "Emacs" "space"))
'("Visit Mars" "Visit the moon" "/r/emacs" "Rewrite Emacs in Common Lisp")) '("Visit Mars" "Visit the moon" "/r/emacs" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((not (tags "Emacs" "space"))) (org-ql-expect ('(not (tags "Emacs" "space")))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over 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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over 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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony")))
(org-ql-it "with file tags" (org-ql-it "with file tags"
(org-ql-expect ((tags "food")) (org-ql-expect ('(tags "food"))
'("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato") '("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato")
:buffer (org-ql-test-data-buffer "data2.org")) :buffer (org-ql-test-data-buffer "data2.org"))
(org-ql-expect ((tags "fruit")) (org-ql-expect ('(tags "fruit"))
'("Fruit" "Blueberry" "Strawberry") '("Fruit" "Blueberry" "Strawberry")
:buffer (org-ql-test-data-buffer "data2.org")))) :buffer (org-ql-test-data-buffer "data2.org"))))
(describe "(tags-inherited)" (describe "(tags-inherited)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((tags-inherited)) (org-ql-expect ('(tags-inherited))
'("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")) '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language"))
(org-ql-expect ((not (inherited-tags))) (org-ql-expect ('(not (inherited-tags)))
'("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with a tag" (org-ql-it "with a tag"
(org-ql-expect ((tags-inherited "Emacs")) (org-ql-expect ('(tags-inherited "Emacs"))
nil) nil)
(org-ql-expect ((itags "ambition")) (org-ql-expect ('(itags "ambition"))
'("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")) '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language"))
(org-ql-expect ((not (tags-i "ambition"))) (org-ql-expect ('(not (tags-i "ambition")))
'("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with 2 tags" (org-ql-it "with 2 tags"
(org-ql-expect ((itags "personal" "world")) (org-ql-expect ('(itags "personal" "world"))
'("Skype with president of Antarctica")) '("Skype with president of Antarctica"))
(org-ql-expect ((not (tags-inherited "personal" "world"))) (org-ql-expect ('(not (tags-inherited "personal" "world")))
;; Note that this correctly includes the task "Practice leaping...", which has the LOCAL tag "personal". ;; Note that this correctly includes the task "Practice leaping...", which has the LOCAL tag "personal".
'("Take over the universe" "Take over the world" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the universe" "Take over the world" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with file tags" (org-ql-it "with file tags"
(org-ql-expect ((tags-inherited "food")) (org-ql-expect ('(tags-inherited "food"))
'("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato") '("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato")
:buffer (org-ql-test-data-buffer "data2.org")) :buffer (org-ql-test-data-buffer "data2.org"))
(org-ql-expect ((tags-inherited "fruit")) (org-ql-expect ('(tags-inherited "fruit"))
'("Blueberry" "Strawberry") '("Blueberry" "Strawberry")
:buffer (org-ql-test-data-buffer "data2.org")))) :buffer (org-ql-test-data-buffer "data2.org"))))
(describe "(tags-local)" (describe "(tags-local)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((tags-local)) (org-ql-expect ('(tags-local))
'("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" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony")) '("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" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony"))
(org-ql-expect ((not (local-tags))) (org-ql-expect ('(not (local-tags)))
'("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Recurring" "Sunrise/sunset" "Ideas"))) '("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Recurring" "Sunrise/sunset" "Ideas")))
(org-ql-it "with a tag" (org-ql-it "with a tag"
(org-ql-expect ((tags-local "world")) (org-ql-expect ('(tags-local "world"))
'("Take over the world" "Skype with president of Antarctica")) '("Take over the world" "Skype with president of Antarctica"))
(org-ql-expect ((ltags "ambition")) (org-ql-expect ('(ltags "ambition"))
'("Take over the universe")) '("Take over the universe"))
(org-ql-expect ((not (tags-l "ambition"))) (org-ql-expect ('(not (tags-l "ambition")))
'("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with 2 tags" (org-ql-it "with 2 tags"
(org-ql-expect ((ltags "personal" "world")) (org-ql-expect ('(ltags "personal" "world"))
'("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Get haircut")) '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Get haircut"))
(org-ql-expect ((not (tags-local "personal" "world"))) (org-ql-expect ('(not (tags-local "personal" "world")))
'("Take over the universe" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) '("Take over the universe" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
(org-ql-it "with file tags" (org-ql-it "with file tags"
(org-ql-expect ((tags-local "food")) (org-ql-expect ('(tags-local "food"))
nil nil
:buffer (org-ql-test-data-buffer "data2.org")) :buffer (org-ql-test-data-buffer "data2.org"))
(org-ql-expect ((tags-local "fruit")) (org-ql-expect ('(tags-local "fruit"))
'("Fruit") '("Fruit")
:buffer (org-ql-test-data-buffer "data2.org")))) :buffer (org-ql-test-data-buffer "data2.org"))))
(describe "(tags-all), (tags&)" (describe "(tags-all), (tags&)"
(org-ql-it "with 2 tags" (org-ql-it "with 2 tags"
(org-ql-expect ((tags-all "universe" "personal")) (org-ql-expect ('(tags-all "universe" "personal"))
'("Practice leaping tall buildings in a single bound")) '("Practice leaping tall buildings in a single bound"))
(org-ql-expect ((tags& "ambition" "space")) (org-ql-expect ('(tags& "ambition" "space"))
'("Visit Mars" "Visit the moon"))) '("Visit Mars" "Visit the moon")))
(org-ql-it "with file tags" (org-ql-it "with file tags"
(org-ql-expect ((tags-all "food" "fruit")) (org-ql-expect ('(tags-all "food" "fruit"))
'("Fruit" "Blueberry" "Strawberry") '("Fruit" "Blueberry" "Strawberry")
:buffer (org-ql-test-data-buffer "data2.org")))) :buffer (org-ql-test-data-buffer "data2.org"))))
(describe "(tags-regexp), (tags*)" (describe "(tags-regexp), (tags*)"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((tags-regexp)) (org-ql-expect ('(tags-regexp))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Write a symphony")) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Write a symphony"))
(org-ql-expect ((not (tags*))) (org-ql-expect ('(not (tags*)))
'("Recurring" "Sunrise/sunset" "Ideas"))) '("Recurring" "Sunrise/sunset" "Ideas")))
(org-ql-it "with a tag regexp" (org-ql-it "with a tag regexp"
(org-ql-expect ((tags-regexp "Emac")) (org-ql-expect ('(tags-regexp "Emac"))
'("/r/emacs" "Rewrite Emacs in Common Lisp")) '("/r/emacs" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((not (tags* "Emac"))) (org-ql-expect ('(not (tags* "Emac")))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony")))
(org-ql-it "with 2 tag regexps" (org-ql-it "with 2 tag regexps"
(org-ql-expect ((tags-regexp "Emac" "spac")) (org-ql-expect ('(tags-regexp "Emac" "spac"))
'("Visit Mars" "Visit the moon" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Rewrite Emacs in Common Lisp")) '("Visit Mars" "Visit the moon" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((not (tags* "Emac" "spac"))) (org-ql-expect ('(not (tags* "Emac" "spac")))
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over 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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over 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" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony")))
(org-ql-it "with regexp matching file tags" (org-ql-it "with regexp matching file tags"
(org-ql-expect ((tags-regexp "foo")) (org-ql-expect ('(tags-regexp "foo"))
'("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato") '("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato")
:buffer (org-ql-test-data-buffer "data2.org")) :buffer (org-ql-test-data-buffer "data2.org"))
(org-ql-expect ((tags* "frui")) (org-ql-expect ('(tags* "frui"))
'("Fruit" "Blueberry" "Strawberry") '("Fruit" "Blueberry" "Strawberry")
:buffer (org-ql-test-data-buffer "data2.org")))) :buffer (org-ql-test-data-buffer "data2.org"))))
@ -996,165 +997,165 @@ RESULTS should be a list of strings as returned by
(describe "active" (describe "active"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((ts :type active)) (org-ql-expect ('(ts :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-it ":from a timestamp" (org-ql-it ":from a timestamp"
(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-then
(org-ql-expect ((ts :from today)) (org-ql-expect ('(ts :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")))) '("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
(org-ql-expect ((ts :from 5)) (org-ql-expect ('(ts :from 5))
'("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "Rewrite Emacs in Common Lisp")))) '("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":to a timestamp" (org-ql-it ":to a timestamp"
(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-then
(org-ql-expect ((ts :to today)) (org-ql-expect ('(ts :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")))) '("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
(org-ql-expect ((ts :to -1)) (org-ql-expect ('(ts :to -1))
'("Skype with president of Antarctica")))) '("Skype with president of Antarctica"))))
(org-ql-it ":on a timestamp" (org-ql-it ":on a timestamp"
(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-then
(org-ql-expect ((ts :on today)) (org-ql-expect ('(ts :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")))) '("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
(org-ql-expect ((ts-active :on 2)) (org-ql-expect ('(ts-active :on 2))
'("Take over the world"))))) '("Take over the world")))))
(describe "inactive" (describe "inactive"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((ts :type inactive)) (org-ql-expect ('(ts :type inactive))
'("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))) '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")))
(org-ql-it ":from a timestamp" (org-ql-it ":from a timestamp"
(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-then
(org-ql-expect ((ts-inactive :from today)) (org-ql-expect ('(ts-inactive :from today))
'("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")))) '("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
(org-ql-expect ((ts-i :from 5)) (org-ql-expect ('(ts-i :from 5))
'("Visit the moon" "Rewrite Emacs in Common Lisp")))) '("Visit the moon" "Rewrite Emacs in Common Lisp"))))
(org-ql-it ":to a timestamp" (org-ql-it ":to a timestamp"
(org-ql-expect ((ts :to "2019-06-10" :type inactive)) (org-ql-expect ('(ts :to "2019-06-10" :type inactive))
'("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")) '("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-then
(org-ql-expect ((ts-inactive :to today)) (org-ql-expect ('(ts-inactive :to today))
'("Learn universal sign language")))) '("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
(org-ql-expect ((ts-i :to 5)) (org-ql-expect ('(ts-i :to 5))
'("Learn universal sign language")))) '("Learn universal sign language"))))
(org-ql-it ":on a timestamp" (org-ql-it ":on a timestamp"
(org-ql-expect ((ts :on "2017-07-05" :type inactive)) (org-ql-expect ('(ts :on "2017-07-05" :type inactive))
'("Learn universal sign language")) '("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-then
(org-ql-expect ((ts-inactive :on today)) (org-ql-expect ('(ts-inactive :on today))
'("Learn universal sign language")))) '("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
(org-ql-expect ((ts-inactive :on 19)) (org-ql-expect ('(ts-inactive :on 19))
'("Visit the moon" "Rewrite Emacs in Common Lisp"))))) '("Visit the moon" "Rewrite Emacs in Common Lisp")))))
(describe "both" (describe "both"
(org-ql-it "without arguments" (org-ql-it "without arguments"
(org-ql-expect ((ts)) (org-ql-expect ('(ts))
'("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-expect ((ts :type both)) (org-ql-expect ('(ts :type both))
'("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-it ":from a timestamp" (org-ql-it ":from a timestamp"
(org-ql-expect ((ts :from "2017-07-05")) (org-ql-expect ('(ts :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 ((ts :from "2017-07-05" :type both)) (org-ql-expect ('(ts :from "2017-07-05" :type both))
'("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 ((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-then
(org-ql-expect ((ts :from today)) (org-ql-expect ('(ts :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")))) '("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
(org-ql-expect ((ts :from -5)) (org-ql-expect ('(ts :from -5))
'("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-it ":to a timestamp" (org-ql-it ":to a timestamp"
(org-ql-expect ((ts :to "2017-07-06")) (org-ql-expect ('(ts :to "2017-07-06"))
'("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 ((ts :to "2017-07-06" :type both)) (org-ql-expect ('(ts :to "2017-07-06" :type both))
'("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 ((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-then
(org-ql-expect ((ts :to today)) (org-ql-expect ('(ts :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")))) '("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
(org-ql-expect ((ts :to 5)) (org-ql-expect ('(ts :to 5))
'("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "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 timestamp" (org-ql-it ":on a timestamp"
(org-ql-expect ((ts :on "2017-07-05")) (org-ql-expect ('(ts :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 ((ts :on "2017-07-05" :type both)) (org-ql-expect ('(ts :on "2017-07-05" :type both))
'("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 ((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-then
(org-ql-expect ((ts :on today)) (org-ql-expect ('(ts :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")))) '("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
(org-ql-expect ((ts :on 5)) (org-ql-expect ('(ts :on 5))
'("Renew membership in supervillain club")))))) '("Renew membership in supervillain club"))))))
(describe "Compound queries" (describe "Compound queries"
(org-ql-it "Tags and to-do" (org-ql-it "Tags and to-do"
(org-ql-expect ((and (todo "SOMEDAY") (org-ql-expect ('(and (todo "SOMEDAY")
(tags "Emacs"))) (tags "Emacs")))
'("Rewrite Emacs in Common Lisp"))))) '("Rewrite Emacs in Common Lisp")))))
@ -1469,7 +1470,7 @@ RESULTS should be a list of strings as returned by
:super-groups super-groups :super-groups super-groups
:sort sort :title title :buffer view-buffer) :sort sort :title title :buffer view-buffer)
(with-current-buffer view-buffer (with-current-buffer view-buffer
(cl-assert (member '("org-ql-search" :follow org-ql-view--link-open :store org-ql-view--link-store) (cl-assert (member '("org-ql-search" :follow org-ql-view--link-follow :store org-ql-view--link-store)
org-link-parameters) org-link-parameters)
t) t)
(with-simulated-input store-input (with-simulated-input store-input