From 7ecb80fca9e719bb5f358b561d1f6cbc9ccee248 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Mon, 7 Dec 2020 13:55:18 +0800 Subject: [PATCH] Run `helm-org-ql--heading' as :filtered-candidate-transformer --- helm-org-ql.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/helm-org-ql.el b/helm-org-ql.el index 54d6566..b634d30 100644 --- a/helm-org-ql.el +++ b/helm-org-ql.el @@ -178,21 +178,27 @@ Is transformed into this query: "Return Helm source named NAME that searches BUFFERS-FILES with `helm-org-ql'." ;; Expansion of `helm-build-sync-source' macro. (helm-make-source name 'helm-source-sync + :filtered-candidate-transformer (lambda (candidates _) + (let ((window-width (window-width (helm-window)))) + (mapcar (lambda (marker) + (unless (markerp marker) (user-error "Unexpected candidate for `helm-org-ql-source'")) + (org-with-point-at marker + (helm-org-ql--heading window-width))) + candidates))) :candidates (lambda () - (let* ((query (org-ql--query-string-to-sexp helm-pattern)) - (window-width (window-width (helm-window)))) + (let* ((query (org-ql--query-string-to-sexp helm-pattern))) (when query (with-current-buffer (helm-buffer-get) (setq helm-org-ql-buffers-files buffers-files)) (ignore-errors ;; Ignore errors that might be caused by partially typed queries. (org-ql-select buffers-files query - :action `(helm-org-ql--heading ,window-width)))))) + :action `(point-marker)))))) :match #'identity :fuzzy-match nil :multimatch nil :nohighlight t - :volatile t + :match-dynamic t :keymap helm-org-ql-map :action helm-org-ql-actions))