This commit is contained in:
Ihor Radchenko 2025-05-04 23:59:42 +00:00 committed by GitHub
commit 820ddf81a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -189,24 +189,29 @@ Is transformed into this query:
(cl-defun helm-org-ql-source (buffers-files &key (name "helm-org-ql")) (cl-defun helm-org-ql-source (buffers-files &key (name "helm-org-ql"))
"Return Helm source named NAME to search BUFFERS-FILES with `helm-org-ql'." "Return Helm source named NAME to search BUFFERS-FILES with `helm-org-ql'."
;; Expansion of `helm-build-sync-source' macro. ;; Expansion of `helm-build-sync-source' macro.
(helm-make-source name 'helm-source-sync (let ((window-width (window-width (helm-window))))
:candidates (lambda () (helm-make-source name 'helm-source-sync
(let* ((query (org-ql--query-string-to-sexp helm-pattern)) :filtered-candidate-transformer (lambda (candidate-markers _)
(window-width (window-width (helm-window)))) (mapcar (lambda (candidate-marker)
(when query (org-with-point-at candidate-marker
(with-current-buffer (helm-buffer-get) (helm-org-ql--heading window-width)))
(setq helm-org-ql-buffers-files buffers-files)) candidate-markers))
(ignore-errors :candidates (lambda ()
;; Ignore errors that might be caused by partially typed queries. (let* ((query (org-ql--query-string-to-sexp helm-pattern)))
(org-ql-select buffers-files query (when query
:action `(helm-org-ql--heading ,window-width)))))) (with-current-buffer (helm-buffer-get)
:match #'identity (setq helm-org-ql-buffers-files buffers-files))
:fuzzy-match nil (ignore-errors
:multimatch nil ;; Ignore errors that might be caused by partially typed queries.
:nohighlight t (org-ql-select buffers-files query
:volatile t :action `(point-marker))))))
:keymap helm-org-ql-map :match #'identity
:action helm-org-ql-actions)) :fuzzy-match nil
:multimatch nil
:nohighlight t
:match-dynamic t
:keymap helm-org-ql-map
:action helm-org-ql-actions)))
(defun helm-org-ql--heading (window-width) (defun helm-org-ql--heading (window-width)
"Return string for Helm for heading at point. "Return string for Helm for heading at point.