From f65b1d91a49468e176bd733d3b930ec4b7ed4cf1 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Wed, 6 Sep 2023 20:50:39 -0500 Subject: [PATCH] Fix: (org-ql--normalize-from-to-on) Tolerate "-" input Avoids errors while typing a query (e.g. a negative number) into org-ql-find, which interrupts completion altogether. --- README.org | 3 ++- org-ql.el | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 32d6662..92d5cb5 100644 --- a/README.org +++ b/README.org @@ -544,7 +544,8 @@ Simple links may also be written manually in either sexp or non-sexp form, like: ** 0.7.2-pre -Nothing new yet. +*Fixes* ++ Timestamp predicates are more tolerant of partial input (e.g. preventing errors while the user is typing a query into ~org-ql-find~). ** 0.7.1 diff --git a/org-ql.el b/org-ql.el index b92784e..e153138 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1286,6 +1286,9 @@ result form." to on)) (when from (setq from (pcase from + ("-" + ;; Ignore, because it means the user is typing a negative number. + nil) ((or 'today "today") (->> (ts-now) (ts-apply :hour 0 :minute 0 :second 0))) ((pred numberp) (->> (ts-now) @@ -1302,6 +1305,9 @@ result form." ((pred ts-p) from)))) (when to (setq to (pcase to + ("-" + ;; Ignore, because it means the user is typing a negative number. + nil) ((or 'today "today") (->> (ts-now) (ts-apply :hour 23 :minute 59 :second 59))) ((pred numberp) (->> (ts-now)