Fix: (--pre-process-query) level predicate with args in plain query

Fixes #96.  Thanks to Akira Komamura (@akirak) for reporting.

Released as 0.4.1.
This commit is contained in:
Adam Porter 2020-02-23 23:22:11 -06:00
parent 538373bb48
commit 32c68d7f24
4 changed files with 83 additions and 47 deletions

View file

@ -398,6 +398,11 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
/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.4.1
*Fixed*
+ =level= predicate used with arguments in plain queries. (Thanks to [[https://github.com/akirak][Akira Komamura]] for reporting.)
** 0.4
/Note:/ The next release, 0.5, may include changes which will require minor updates to written queries (e.g. a few predicates may be renamed). Users who wish to avoid those changes happening unexpectedly in their configs should avoid upgrading =org-ql= beyond 0.4 automatically, as they will be pushed to the =master= branch when ready.

View file

@ -2,7 +2,7 @@
;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql
;; Version: 0.4
;; Version: 0.4.1
;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (f "0.17.2") (org "9.0") (org-super-agenda "1.2-pre") (ov "1.0.6") (peg "0.6") (s "1.12.0") (ts "0.2-pre"))
;; Keywords: hypermedia, outlines, Org, agenda
@ -583,6 +583,16 @@ Replaces bare strings with (regexp) selectors, and appropriate
;; "h" alias.
`(heading ,@args))
;; Outline level.
(`(level . ,args)
;; Arguments could be given as strings (e.g. from a non-Lisp query).
`(level ,@(--map (pcase it
((or "<" "<=" ">" ">=" "=")
(intern it))
((pred stringp) (string-to-number it))
(_ it))
args)))
;; Regexps.
(`(r . ,args)
;; "r" alias.

View file

@ -63,6 +63,7 @@ Functions / Macros
Changelog
* 0.4.1: 041.
* 0.4: 04.
* 0.3.2: 032.
* 0.3.1: 031.
@ -703,6 +704,7 @@ releases.
* Menu:
* 0.4.1: 041.
* 0.4: 04.
* 0.3.2: 032.
* 0.3.1: 031.
@ -714,9 +716,19 @@ releases.
* 0.1: 01.

File: README.info, Node: 04, Next: 032, Up: Changelog
File: README.info, Node: 041, Next: 04, Up: Changelog
5.1 0.4
5.1 0.4.1
=========
*Fixed*
• level predicate used with arguments in plain queries. (Thanks to
Akira Komamura (https://github.com/akirak) for reporting.)

File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog
5.2 0.4
=======
_Note:_ The next release, 0.5, may include changes which will require
@ -797,7 +809,7 @@ as they will be pushed to the master branch when ready.

File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
5.2 0.3.2
5.3 0.3.2
=========
*Fixed*
@ -810,7 +822,7 @@ File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog

File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
5.3 0.3.1
5.4 0.3.1
=========
*Fixed*
@ -820,7 +832,7 @@ File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog

File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
5.4 0.3
5.5 0.3
=======
*Added*
@ -885,7 +897,7 @@ File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog

File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
5.5 0.2.3
5.6 0.2.3
=========
*Fixed*
@ -895,7 +907,7 @@ File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog

File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
5.6 0.2.2
5.7 0.2.2
=========
*Fixed*
@ -906,7 +918,7 @@ File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog

File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
5.7 0.2.1
5.8 0.2.1
=========
*Fixed*
@ -916,7 +928,7 @@ File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog

File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
5.8 0.2
5.9 0.2
=======
*Added*
@ -999,8 +1011,8 @@ File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog

File: README.info, Node: 01, Prev: 02, Up: Changelog
5.9 0.1
=======
5.10 0.1
========
First tagged release.
@ -1060,40 +1072,41 @@ GPLv3

Tag Table:
Node: Top225
Node: Contents1402
Node: Screenshots1576
Node: Installation1694
Node: Quelpa2332
Node: Usage2775
Node: Commands3124
Node: org-ql-search3597
Node: helm-org-ql5245
Node: org-ql-view5657
Node: org-ql-view-sidebar5855
Node: org-ql-view-recent-items6211
Node: org-ql-sparse-tree6695
Node: Queries7495
Node: Non-sexp query syntax8403
Node: General predicates10110
Node: Ancestor/descendant predicates14917
Node: Date/time predicates16045
Node: Functions / Macros18700
Node: Agenda-like views18933
Node: Listing / acting-on results20338
Node: Changelog24940
Node: 0425469
Node: 03229388
Node: 03129765
Node: 0329960
Node: 02332933
Node: 02233159
Node: 02133425
Node: 0233622
Node: 0137655
Node: Notes37754
Node: Comparison with Org Agenda searches37916
Node: org-sidebar38787
Node: License39066
Node: Contents1417
Node: Screenshots1591
Node: Installation1709
Node: Quelpa2347
Node: Usage2790
Node: Commands3139
Node: org-ql-search3612
Node: helm-org-ql5260
Node: org-ql-view5672
Node: org-ql-view-sidebar5870
Node: org-ql-view-recent-items6226
Node: org-ql-sparse-tree6710
Node: Queries7510
Node: Non-sexp query syntax8418
Node: General predicates10125
Node: Ancestor/descendant predicates14932
Node: Date/time predicates16060
Node: Functions / Macros18715
Node: Agenda-like views18948
Node: Listing / acting-on results20353
Node: Changelog24955
Node: 04125499
Node: 0425726
Node: 03229657
Node: 03130034
Node: 0330229
Node: 02333202
Node: 02233428
Node: 02133694
Node: 0233891
Node: 0137924
Node: Notes38025
Node: Comparison with Org Agenda searches38187
Node: org-sidebar39058
Node: License39337

End Tag Table

View file

@ -216,7 +216,15 @@ RESULTS should be a list of strings as returned by
:order-by 'date))
:to-equal org-ql-test-num-headings)))
(it "Query pre-processing"
(describe "Query pre-processing"
(it "level:"
(expect (org-ql--pre-process-query '(level "1"))
:to-equal '(level 1))
(expect (org-ql--pre-process-query '(level "1" "2"))
:to-equal '(level 1 2))
(expect (org-ql--pre-process-query '(level ">" "1"))
:to-equal '(level > 1)))
(expect (org-ql--pre-process-query '(and "string1" "string2"))
:to-equal '(and (regexp "string1") (regexp "string2")))
(expect (org-ql--pre-process-query '(or "string1" "string2"))