@@ -1415,7 +1415,15 @@ Matching is done case-insensitively."
14151415 ; ; "h" alias.
14161416 `(heading ,@args )))
14171417 ; ; 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 )
14191427 ; ; Only one string: match with preamble, then let predicate confirm (because
14201428 ; ; the match could be in e.g. the tags rather than the heading text).
14211429 (list :regexp (rx-to-string `(seq bol (1+ " *" ) (1+ blank) (0+ nonl)
@@ -1442,7 +1450,15 @@ Matching is done case-insensitively."
14421450 ; ; "h" alias.
14431451 `(heading-regexp ,@args )))
14441452 ; ; 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 )
14461462 ; ; Only one regexp: match with preamble, then let predicate confirm (because
14471463 ; ; the match could be in e.g. the tags rather than the heading text).
14481464 (list :regexp (rx-to-string `(seq bol (1+ " *" ) (1+ blank) (0+ nonl)
@@ -1478,7 +1494,15 @@ COMPARATOR may be `<', `<=', `>', or `>='."
14781494 ((pred stringp) (string-to-number it))
14791495 (_ it))
14801496 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 )
14821506 (let ((repeat (pcase comparator-or-num
14831507 ('< `(repeat 1 ,(1- num) " *" ))
14841508 ('<= `(repeat 1 , num " *" ))
@@ -1736,7 +1760,18 @@ entry; if t, also match entries with inheritance. If INHERIT is
17361760not specified, use the Boolean value of
17371761`org-use-property-inheritance' , which see (i.e. it is only
17381762interpreted 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 )
17401775 ; ; Convert keyword property arguments to strings. Non-sexp
17411776 ; ; queries result in keyword property arguments (because to do
17421777 ; ; otherwise would require ugly special-casing in the parsing).
0 commit comments