@@ -1415,7 +1415,15 @@ Matching is done case-insensitively."
1415
1415
; ; "h" alias.
1416
1416
`(heading ,@args )))
1417
1417
; ; TODO: Adjust regexp to avoid matching in tag list.
1418
- :preambles ((`(, predicate-names , string )
1418
+ :preambles ((`(, predicate-names )
1419
+ ; ; This clause protects against the case in which the
1420
+ ; ; arguments are nil, which would cause an error in
1421
+ ; ; `rx-to-string' in other clauses. This can happen
1422
+ ; ; with `org-ql-completing-read' , e.g. when the input
1423
+ ; ; is "h:" while the user is typing.
1424
+ (list :regexp (rx bol (1+ " *" ) (1+ blank) (0+ nonl))
1425
+ :case-fold t :query query))
1426
+ (`(, predicate-names , string )
1419
1427
; ; Only one string: match with preamble, then let predicate confirm (because
1420
1428
; ; the match could be in e.g. the tags rather than the heading text).
1421
1429
(list :regexp (rx-to-string `(seq bol (1+ " *" ) (1+ blank) (0+ nonl)
@@ -1442,7 +1450,15 @@ Matching is done case-insensitively."
1442
1450
; ; "h" alias.
1443
1451
`(heading-regexp ,@args )))
1444
1452
; ; MAYBE: Adjust regexp to avoid matching in tag list.
1445
- :preambles ((`(, predicate-names , regexp )
1453
+ :preambles ((`(, predicate-names )
1454
+ ; ; This clause protects against the case in which the
1455
+ ; ; arguments are nil, which would cause an error in
1456
+ ; ; `rx-to-string' in other clauses. This can happen
1457
+ ; ; with `org-ql-completing-read' , e.g. when the input
1458
+ ; ; is "h:" while the user is typing.
1459
+ (list :regexp (rx bol (1+ " *" ) (1+ blank) (0+ nonl))
1460
+ :case-fold t :query query))
1461
+ (`(, predicate-names , regexp )
1446
1462
; ; Only one regexp: match with preamble, then let predicate confirm (because
1447
1463
; ; the match could be in e.g. the tags rather than the heading text).
1448
1464
(list :regexp (rx-to-string `(seq bol (1+ " *" ) (1+ blank) (0+ nonl)
@@ -1478,7 +1494,15 @@ COMPARATOR may be `<', `<=', `>', or `>='."
1478
1494
((pred stringp) (string-to-number it))
1479
1495
(_ it))
1480
1496
args))))
1481
- :preambles ((`(, predicate-names , comparator-or-num , num )
1497
+ :preambles ((`(, predicate-names )
1498
+ ; ; This clause protects against the case in which the
1499
+ ; ; arguments are nil, which would cause an error in
1500
+ ; ; `rx-to-string' in other clauses. This can happen
1501
+ ; ; with `org-ql-completing-read' , e.g. when the input
1502
+ ; ; is "h:" while the user is typing.
1503
+ (list :regexp (rx bol (1+ " *" ) " " )
1504
+ :case-fold t ))
1505
+ (`(, predicate-names , comparator-or-num , num )
1482
1506
(let ((repeat (pcase comparator-or-num
1483
1507
('< `(repeat 1 ,(1- num) " *" ))
1484
1508
('<= `(repeat 1 , num " *" ))
@@ -1736,7 +1760,18 @@ entry; if t, also match entries with inheritance. If INHERIT is
1736
1760
not specified, use the Boolean value of
1737
1761
`org-use-property-inheritance' , which see (i.e. it is only
1738
1762
interpreted as nil or non-nil)."
1739
- :normalizers ((`(, predicate-names , property , value . , plist )
1763
+ :normalizers ((`(, predicate-names )
1764
+ ; ; HACK: This clause protects against the case in
1765
+ ; ; which the arguments are nil, which would cause an
1766
+ ; ; error in `rx-to-string' in other clauses. This
1767
+ ; ; can happen with `org-ql-completing-read' ,
1768
+ ; ; e.g. when the input is "property:" while the user
1769
+ ; ; is typing.
1770
+ ; ; FIXME: Instead of this being moot, make this
1771
+ ; ; predicate test for whether an entry has local
1772
+ ; ; properties when no arguments are given.
1773
+ (list 'property " " ))
1774
+ (`(, predicate-names , property , value . , plist )
1740
1775
; ; Convert keyword property arguments to strings. Non-sexp
1741
1776
; ; queries result in keyword property arguments (because to do
1742
1777
; ; otherwise would require ugly special-casing in the parsing).
0 commit comments