Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run `helm-org-ql--heading' as :filtered-candidate-transformer #162

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
14 changes: 10 additions & 4 deletions helm-org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 _)
yantar92 marked this conversation as resolved.
Show resolved Hide resolved
(let ((window-width (window-width (helm-window))))
yantar92 marked this conversation as resolved.
Show resolved Hide resolved
yantar92 marked this conversation as resolved.
Show resolved Hide resolved
(mapcar (lambda (marker)
(unless (markerp marker) (user-error "Unexpected candidate for `helm-org-ql-source'"))
yantar92 marked this conversation as resolved.
Show resolved Hide resolved
(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))

Expand Down