Merge branch 'wip/0.6-pre' into wip/define-predicate

Rebasing this was a huge pain, and I had to abort.  But merging
actually worked!
This commit is contained in:
Adam Porter 2020-11-22 19:29:15 -06:00
commit 73d4f95cd4
5 changed files with 353 additions and 298 deletions

View file

@ -461,7 +461,11 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
/Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases. /Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases.
** 0.5-pre ** 0.6-pre
Nothing new yet.
** 0.5
*Added* *Added*
+ View dispatcher using =transient.el= (like Magit), bound to =v= in search/view buffers. + View dispatcher using =transient.el= (like Magit), bound to =v= in search/view buffers.
@ -478,6 +482,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

@ -578,7 +578,7 @@ dates in the past, and negative for dates in the future."
;; than `org-ql-view' saved views, the link type is "org-ql-search". ;; than `org-ql-view' saved views, the link type is "org-ql-search".
(org-link-set-parameters "org-ql-search" (org-link-set-parameters "org-ql-search"
:follow #'org-ql-view--link-open :follow #'org-ql-view--link-follow
:store #'org-ql-view--link-store) :store #'org-ql-view--link-store)
;; We require the URL libraries in the functions to hopefully avoid ;; We require the URL libraries in the functions to hopefully avoid
@ -588,10 +588,13 @@ dates in the past, and negative for dates in the future."
(require 'url-parse) (require 'url-parse)
(require 'url-util)) (require 'url-util))
(defun org-ql-view--link-open (path) (defun org-ql-view--link-follow (path &optional _ignored)
"Open Org QL query for current buffer at PATH. "Open Org QL query for current buffer at PATH.
PATH should be the part of an \"org-ql-search:\" URL after the PATH should be the part of an \"org-ql-search:\" URL after the
protocol. See, e.g. `org-ql-view--link-store'." protocol. See, e.g. `org-ql-view--link-store'.
The optional, second argument is temporarily _IGNORED for
purposes of compatibility with changes in Org 9.4."
(require 'url-parse) (require 'url-parse)
(require 'url-util) (require 'url-util)
(when (version<= "9.3" (org-version)) (when (version<= "9.3" (org-version))

View file

@ -2,8 +2,8 @@
;; Author: Adam Porter <adam@alphapapa.net> ;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql ;; Url: https://github.com/alphapapa/org-ql
;; Version: 0.5-pre ;; Version: 0.6-pre
;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (f "0.17.2") (map "2.1") (org "9.0") (org-super-agenda "1.2-pre") (ov "1.0.6") (peg "0.6") (s "1.12.0") (transient "0.1") (ts "0.2-pre")) ;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (f "0.17.2") (map "2.1") (org "9.0") (org-super-agenda "1.2") (ov "1.0.6") (peg "0.6") (s "1.12.0") (transient "0.1") (ts "0.2-pre"))
;; Keywords: hypermedia, outlines, Org, agenda ;; Keywords: hypermedia, outlines, Org, agenda
;;; Commentary: ;;; Commentary:
@ -136,7 +136,7 @@ This list should not contain any duplicates."))
(defgroup org-ql nil (defgroup org-ql nil
"Customization for `org-ql'." "Customization for `org-ql'."
:group 'org :group 'org
;; TODO: Add info manual link. :link '(custom-manual "(org-ql)Usage")
:link '(url-link "https://github.com/alphapapa/org-ql")) :link '(url-link "https://github.com/alphapapa/org-ql"))
(defcustom org-ql-ask-unsafe-queries t (defcustom org-ql-ask-unsafe-queries t
@ -159,12 +159,39 @@ See Info node `(org-ql)Queries'."
;;;; Macros ;;;; Macros
;; TODO: Mark as obsolete/deprecated. (cl-defmacro org-ql--defpred (name args docstring &rest body)
"Define an `org-ql' selector predicate named `org-ql--predicate-NAME'.
NAME may be a symbol or a list of symbols: if a list, the first
is used as the name and the rest are aliases. ARGS is a
`cl-defun'-style argument list. DOCSTRING is the function's
docstring. BODY is the body of the predicate.
Predicates will be called with point on the beginning of an Org
heading and should return non-nil if the heading's entry is a
match."
(declare (debug ([&or symbolp listp] listp stringp def-body))
(indent defun))
(let* ((aliases (when (listp name)
(cdr name)))
(name (cl-etypecase name
(list (car name))
(atom name)))
(fn-name (intern (concat "org-ql--predicate-" (symbol-name name))))
(pred-name (intern (symbol-name name))))
`(progn
(cl-eval-when (compile load eval)
;; When compiling, the predicate must be added to `org-ql-predicates' before `org-ql--def-plain-query-fn'
;; is called to define `org-ql--plain-query'. Otherwise, `org-ql--plain-query' seems to work properly
;; when interpreted but not always when the file is byte-compiled.
(push (list :name ',pred-name :aliases ',aliases :fn ',fn-name :docstring ,docstring :args ',args) org-ql-predicates))
(cl-defun ,fn-name ,args ,docstring ,@body))))
;;;###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

@ -66,7 +66,8 @@ Functions / Macros
Changelog Changelog
* 0.5-pre: 05-pre. * 0.6-pre: 06-pre.
* 0.5: 05.
* 0.4.9: 049. * 0.4.9: 049.
* 0.4.8: 048. * 0.4.8: 048.
* 0.4.7: 047. * 0.4.7: 047.
@ -831,7 +832,8 @@ releases.
* Menu: * Menu:
* 0.5-pre: 05-pre. * 0.6-pre: 06-pre.
* 0.5: 05.
* 0.4.9: 049. * 0.4.9: 049.
* 0.4.8: 048. * 0.4.8: 048.
* 0.4.7: 047. * 0.4.7: 047.
@ -852,11 +854,19 @@ releases.
* 0.1: 01. * 0.1: 01.
 
File: README.info, Node: 05-pre, Next: 049, Up: Changelog File: README.info, Node: 06-pre, Next: 05, Up: Changelog
5.1 0.5-pre 5.1 0.6-pre
=========== ===========
Nothing new yet.

File: README.info, Node: 05, Next: 049, Prev: 06-pre, Up: Changelog
5.2 0.5
=======
*Added* *Added*
• View dispatcher using transient.el (like Magit), bound to v in • View dispatcher using transient.el (like Magit), bound to v in
search/view buffers. search/view buffers.
@ -882,14 +892,20 @@ 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.
 
File: README.info, Node: 049, Next: 048, Prev: 05-pre, Up: Changelog File: README.info, Node: 049, Next: 048, Prev: 05, Up: Changelog
5.2 0.4.9 5.3 0.4.9
========= =========
*Fixed* *Fixed*
@ -900,7 +916,7 @@ File: README.info, Node: 049, Next: 048, Prev: 05-pre, Up: Changelog
 
File: README.info, Node: 048, Next: 047, Prev: 049, Up: Changelog File: README.info, Node: 048, Next: 047, Prev: 049, Up: Changelog
5.3 0.4.8 5.4 0.4.8
========= =========
*Fixed* *Fixed*
@ -912,7 +928,7 @@ File: README.info, Node: 048, Next: 047, Prev: 049, Up: Changelog
 
File: README.info, Node: 047, Next: 046, Prev: 048, Up: Changelog File: README.info, Node: 047, Next: 046, Prev: 048, Up: Changelog
5.4 0.4.7 5.5 0.4.7
========= =========
*Fixed* *Fixed*
@ -925,7 +941,7 @@ File: README.info, Node: 047, Next: 046, Prev: 048, Up: Changelog
 
File: README.info, Node: 046, Next: 045, Prev: 047, Up: Changelog File: README.info, Node: 046, Next: 045, Prev: 047, Up: Changelog
5.5 0.4.6 5.6 0.4.6
========= =========
*Fixed* *Fixed*
@ -938,7 +954,7 @@ File: README.info, Node: 046, Next: 045, Prev: 047, Up: Changelog
 
File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog
5.6 0.4.5 5.7 0.4.5
========= =========
*Fixed* *Fixed*
@ -950,7 +966,7 @@ File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog
 
File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog
5.7 0.4.4 5.8 0.4.4
========= =========
*Fixed* *Fixed*
@ -962,7 +978,7 @@ File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog
 
File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
5.8 0.4.3 5.9 0.4.3
========= =========
*Fixed* *Fixed*
@ -972,8 +988,8 @@ File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
 
File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
5.9 0.4.2 5.10 0.4.2
========= ==========
*Fixed* *Fixed*
• Items to-do keywords were not shown in views. • Items to-do keywords were not shown in views.
@ -981,7 +997,7 @@ File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
 
File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
5.10 0.4.1 5.11 0.4.1
========== ==========
*Fixed* *Fixed*
@ -991,7 +1007,7 @@ File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
 
File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog
5.11 0.4 5.12 0.4
======== ========
_Note:_ The next release, 0.5, may include changes which will require _Note:_ The next release, 0.5, may include changes which will require
@ -1072,7 +1088,7 @@ as they will be pushed to the master branch when ready.
 
File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
5.12 0.3.2 5.13 0.3.2
========== ==========
*Fixed* *Fixed*
@ -1085,7 +1101,7 @@ File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
 
File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
5.13 0.3.1 5.14 0.3.1
========== ==========
*Fixed* *Fixed*
@ -1095,7 +1111,7 @@ File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
 
File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
5.14 0.3 5.15 0.3
======== ========
*Added* *Added*
@ -1160,7 +1176,7 @@ File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
 
File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
5.15 0.2.3 5.16 0.2.3
========== ==========
*Fixed* *Fixed*
@ -1170,7 +1186,7 @@ File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
 
File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
5.16 0.2.2 5.17 0.2.2
========== ==========
*Fixed* *Fixed*
@ -1181,7 +1197,7 @@ File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
 
File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
5.17 0.2.1 5.18 0.2.1
========== ==========
*Fixed* *Fixed*
@ -1191,7 +1207,7 @@ File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
 
File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
5.18 0.2 5.19 0.2
======== ========
*Added* *Added*
@ -1274,7 +1290,7 @@ File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
 
File: README.info, Node: 01, Prev: 02, Up: Changelog File: README.info, Node: 01, Prev: 02, Up: Changelog
5.19 0.1 5.20 0.1
======== ========
First tagged release. First tagged release.
@ -1332,53 +1348,54 @@ GPLv3
 
Tag Table: Tag Table:
Node: Top225 Node: Top225
Node: Contents1594 Node: Contents1606
Node: Screenshots1717 Node: Screenshots1729
Node: Installation1835 Node: Installation1847
Node: Quelpa2473 Node: Quelpa2485
Node: Usage2916 Node: Usage2928
Node: Commands3314 Node: Commands3326
Node: org-ql-search3787 Node: org-ql-search3799
Node: helm-org-ql5437 Node: helm-org-ql5449
Node: org-ql-view5849 Node: org-ql-view5861
Node: org-ql-view-sidebar6349 Node: org-ql-view-sidebar6361
Node: org-ql-view-recent-items6705 Node: org-ql-view-recent-items6717
Node: org-ql-sparse-tree7189 Node: org-ql-sparse-tree7201
Node: Queries7989 Node: Queries8001
Node: Non-sexp query syntax9100 Node: Non-sexp query syntax9112
Node: General predicates10807 Node: General predicates10819
Node: Ancestor/descendant predicates16220 Node: Ancestor/descendant predicates16232
Node: Date/time predicates17348 Node: Date/time predicates17360
Node: Functions / Macros20003 Node: Functions / Macros20015
Node: Agenda-like views20258 Node: Agenda-like views20270
Node: Listing / acting-on results21663 Node: Listing / acting-on results21675
Node: Dynamic block26858 Node: Dynamic block26870
Node: Links29556 Node: Links29568
Node: Tips30243 Node: Tips30255
Node: Changelog30561 Node: Changelog30573
Node: 05-pre31245 Node: 06-pre31269
Node: 04932484 Node: 0531375
Node: 04832762 Node: 04932852
Node: 04733109 Node: 04833126
Node: 04633504 Node: 04733473
Node: 04533904 Node: 04633868
Node: 04434263 Node: 04534268
Node: 04334620 Node: 04434627
Node: 04234815 Node: 04334984
Node: 04134974 Node: 04235179
Node: 0435215 Node: 04135340
Node: 03239148 Node: 0435581
Node: 03139527 Node: 03239514
Node: 0339724 Node: 03139893
Node: 02342699 Node: 0340090
Node: 02242927 Node: 02343065
Node: 02143195 Node: 02243293
Node: 0243394 Node: 02143561
Node: 0147429 Node: 0243760
Node: Notes47530 Node: 0147795
Node: Comparison with Org Agenda searches47692 Node: Notes47896
Node: org-sidebar48564 Node: Comparison with Org Agenda searches48058
Node: License48843 Node: org-sidebar48930
Node: License49209
 
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--normalize-query . _) (format "'%S" (eval sexp))) (`(org-ql--normalize-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))
@ -436,423 +437,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
@ -861,147 +862,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"))))
@ -1010,165 +1011,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")))))
@ -1483,7 +1484,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