From 2b7d4e0e79260b5caa9cf978ee80edf03c7c981d Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Tue, 22 Mar 2022 17:59:01 +0900 Subject: [PATCH] Fix: Accept plain queries in interactive org-ql-sparse-tree --- org-ql-search.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org-ql-search.el b/org-ql-search.el index cedcadb..b442b38 100644 --- a/org-ql-search.el +++ b/org-ql-search.el @@ -102,7 +102,7 @@ matches, which allows stacking calls to this command. Runs `org-occur-hook' after making the sparse tree." ;; Code based on `org-occur'. - (interactive (list (read-minibuffer "Query: ") + (interactive (list (read-string "Query: ") :keep-previous current-prefix-arg)) (with-current-buffer buffer (unless keep-previous @@ -110,7 +110,15 @@ Runs `org-occur-hook' after making the sparse tree." ;; we remove existing `org-occur' highlights, just in case. (org-remove-occur-highlights nil nil t) (org-overview)) - (let ((num-results 0)) + (let ((num-results 0) + (query (cl-etypecase query + (string (if (or (string-prefix-p "(" query) + (string-prefix-p "\"" query)) + ;; Read sexp query. + (read query) + ;; Parse non-sexp query into sexp query. + (org-ql--query-string-to-sexp query))) + (list query)))) ;; FIXME: Accept plain queries as well. (org-ql-select buffer query :action (lambda ()