Fix: (level) Check number argument for preamble
This allows a query like this: (level <= (string-to-number (property PROPERTY))) to proceed without signaling an error from ORG-QL--QUERY-PREAMBLE. See #460. Reported-by: Stewmath <https://github.com/Stewmath>
This commit is contained in:
parent
3e7f48ad7e
commit
5ea97d2272
4 changed files with 57 additions and 45 deletions
|
|
@ -557,6 +557,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
|
||||||
|
|
||||||
*Fixes*
|
*Fixes*
|
||||||
+ Predicate ~property~ when called with argument form ~(property "PROPERTY-NAME" :inherit t)~. ([[https://github.com/alphapapa/org-ql/issues/460][#460]]. Thanks to [[https://github.com/Stewmath][Stewmath]] for reporting.)
|
+ Predicate ~property~ when called with argument form ~(property "PROPERTY-NAME" :inherit t)~. ([[https://github.com/alphapapa/org-ql/issues/460][#460]]. Thanks to [[https://github.com/Stewmath][Stewmath]] for reporting.)
|
||||||
|
+ Predicate ~level~'s preamble optimizer allows expressions in place of the numeric argument. (See [[https://github.com/alphapapa/org-ql/issues/460][#460]]. Thanks to [[https://github.com/Stewmath][Stewmath]] for reporting.)
|
||||||
+ Reading of view settings from Org links in upcoming Emacs version. ([[https://github.com/alphapapa/org-ql/issues/461][#461]]. Thanks to [[https://github.com/snogge][Ola Nilsson]] for help debugging, and for maintaining [[https://github.com/jorgenschaefer/emacs-buttercup][Buttercup]].)
|
+ Reading of view settings from Org links in upcoming Emacs version. ([[https://github.com/alphapapa/org-ql/issues/461][#461]]. Thanks to [[https://github.com/snogge][Ola Nilsson]] for help debugging, and for maintaining [[https://github.com/jorgenschaefer/emacs-buttercup][Buttercup]].)
|
||||||
|
|
||||||
** 0.8.8
|
** 0.8.8
|
||||||
|
|
|
||||||
|
|
@ -1534,7 +1534,8 @@ COMPARATOR may be `<', `<=', `>', or `>='."
|
||||||
;; is "h:" while the user is typing.
|
;; is "h:" while the user is typing.
|
||||||
(list :regexp (rx bol (1+ "*") " ")
|
(list :regexp (rx bol (1+ "*") " ")
|
||||||
:case-fold t))
|
:case-fold t))
|
||||||
(`(,predicate-names ,comparator-or-num ,num)
|
((and `(,predicate-names ,comparator-or-num ,num)
|
||||||
|
(guard (numberp num)))
|
||||||
(let ((repeat (pcase comparator-or-num
|
(let ((repeat (pcase comparator-or-num
|
||||||
('< `(repeat 1 ,(1- num) "*"))
|
('< `(repeat 1 ,(1- num) "*"))
|
||||||
('<= `(repeat 1 ,num "*"))
|
('<= `(repeat 1 ,num "*"))
|
||||||
|
|
@ -1543,7 +1544,8 @@ COMPARATOR may be `<', `<=', `>', or `>='."
|
||||||
((pred integerp) `(repeat ,comparator-or-num ,num "*")))))
|
((pred integerp) `(repeat ,comparator-or-num ,num "*")))))
|
||||||
(list :regexp (rx-to-string `(seq bol ,repeat " ") t)
|
(list :regexp (rx-to-string `(seq bol ,repeat " ") t)
|
||||||
:case-fold t)))
|
:case-fold t)))
|
||||||
(`(,predicate-names ,num)
|
((and `(,predicate-names ,num)
|
||||||
|
(guard (numberp num)))
|
||||||
(list :regexp (rx-to-string `(seq bol (repeat ,num "*") " ") t)
|
(list :regexp (rx-to-string `(seq bol (repeat ,num "*") " ") t)
|
||||||
:case-fold t)))
|
:case-fold t)))
|
||||||
;; NOTE: It might be necessary to take into account `org-odd-levels'; see docstring for
|
;; NOTE: It might be necessary to take into account `org-odd-levels'; see docstring for
|
||||||
|
|
|
||||||
90
org-ql.info
90
org-ql.info
|
|
@ -1089,6 +1089,10 @@ File: README.info, Node: 089-pre, Next: 088, Up: Changelog
|
||||||
"PROPERTY-NAME" :inherit t)’. (#460
|
"PROPERTY-NAME" :inherit t)’. (#460
|
||||||
(https://github.com/alphapapa/org-ql/issues/460). Thanks to
|
(https://github.com/alphapapa/org-ql/issues/460). Thanks to
|
||||||
Stewmath (https://github.com/Stewmath) for reporting.)
|
Stewmath (https://github.com/Stewmath) for reporting.)
|
||||||
|
• Predicate ‘level’’s preamble optimizer allows expressions in place
|
||||||
|
of the numeric argument. (See #460
|
||||||
|
(https://github.com/alphapapa/org-ql/issues/460). Thanks to
|
||||||
|
Stewmath (https://github.com/Stewmath) for reporting.)
|
||||||
• Reading of view settings from Org links in upcoming Emacs version.
|
• Reading of view settings from Org links in upcoming Emacs version.
|
||||||
(#461 (https://github.com/alphapapa/org-ql/issues/461). Thanks to
|
(#461 (https://github.com/alphapapa/org-ql/issues/461). Thanks to
|
||||||
Ola Nilsson (https://github.com/snogge) for help debugging, and for
|
Ola Nilsson (https://github.com/snogge) for help debugging, and for
|
||||||
|
|
@ -2073,49 +2077,49 @@ Node: Links38939
|
||||||
Node: Tips39626
|
Node: Tips39626
|
||||||
Node: Changelog39950
|
Node: Changelog39950
|
||||||
Node: 089-pre40900
|
Node: 089-pre40900
|
||||||
Node: 08841554
|
Node: 08841801
|
||||||
Node: 08742634
|
Node: 08742881
|
||||||
Node: 08643862
|
Node: 08644109
|
||||||
Node: 08544096
|
Node: 08544343
|
||||||
Node: 08444752
|
Node: 08444999
|
||||||
Node: 08345204
|
Node: 08345451
|
||||||
Node: 08245545
|
Node: 08245792
|
||||||
Node: 08145938
|
Node: 08146185
|
||||||
Node: 0846359
|
Node: 0846606
|
||||||
Node: 07449085
|
Node: 07449332
|
||||||
Node: 07349310
|
Node: 07349557
|
||||||
Node: 07250044
|
Node: 07250291
|
||||||
Node: 07150965
|
Node: 07151212
|
||||||
Node: 0751776
|
Node: 0752023
|
||||||
Node: 06354642
|
Node: 06354889
|
||||||
Node: 06255175
|
Node: 06255422
|
||||||
Node: 06155482
|
Node: 06155729
|
||||||
Node: 0656052
|
Node: 0656299
|
||||||
Node: 05259108
|
Node: 05259355
|
||||||
Node: 05159410
|
Node: 05159657
|
||||||
Node: 0559835
|
Node: 0560082
|
||||||
Node: 04961366
|
Node: 04961613
|
||||||
Node: 04861648
|
Node: 04861895
|
||||||
Node: 04761997
|
Node: 04762244
|
||||||
Node: 04662406
|
Node: 04662653
|
||||||
Node: 04562814
|
Node: 04563061
|
||||||
Node: 04463175
|
Node: 04463422
|
||||||
Node: 04363534
|
Node: 04363781
|
||||||
Node: 04263737
|
Node: 04263984
|
||||||
Node: 04163898
|
Node: 04164145
|
||||||
Node: 0464145
|
Node: 0464392
|
||||||
Node: 03268246
|
Node: 03268493
|
||||||
Node: 03168649
|
Node: 03168896
|
||||||
Node: 0368846
|
Node: 0369093
|
||||||
Node: 02372146
|
Node: 02372393
|
||||||
Node: 02272380
|
Node: 02272627
|
||||||
Node: 02172660
|
Node: 02172907
|
||||||
Node: 0272865
|
Node: 0273112
|
||||||
Node: 0176943
|
Node: 0177190
|
||||||
Node: Notes77044
|
Node: Notes77291
|
||||||
Node: Comparison with Org Agenda searches77206
|
Node: Comparison with Org Agenda searches77453
|
||||||
Node: org-sidebar78095
|
Node: org-sidebar78342
|
||||||
Node: License78374
|
Node: License78621
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -636,6 +636,11 @@ with keyword arg NOW in PLIST."
|
||||||
:to-equal (list :query t
|
:to-equal (list :query t
|
||||||
:preamble (rx bol (repeat 2 4 "*") " ")
|
:preamble (rx bol (repeat 2 4 "*") " ")
|
||||||
:preamble-case-fold t)))
|
:preamble-case-fold t)))
|
||||||
|
(it "with an expression in level number's place"
|
||||||
|
(expect (org-ql--query-preamble '(level <= (string-to-number (property "PROPERTY"))))
|
||||||
|
:to-equal (list :query '(level <= (string-to-number (property "PROPERTY")))
|
||||||
|
:preamble nil
|
||||||
|
:preamble-case-fold t)))
|
||||||
(it "<"
|
(it "<"
|
||||||
(expect (org-ql--query-preamble '(level < 3))
|
(expect (org-ql--query-preamble '(level < 3))
|
||||||
:to-equal (list :query t
|
:to-equal (list :query t
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue