`org-ql-find` snippet function error with `vertico`
OS/platform
linux
Emacs version and provenance
Emacs 30.0.50 commit (20997aa20728a6fc2a3de736e9fc718b97dcef99). GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0) of 2024-02-17
Emacs command
with-emacs.sh -i vertico -i org-ql
Org version and provenance
Org mode version 9.7-pre (release_N/A-N/A-57ec01 @ ~/.local/etc/emacs/elpa/org-9.7pre0.20240308.61420/)
Installed from elpa with package-install-upgrade-built-in = t
org-ql package version and provenance
Version: 20240222.200 Commit: e41fe9018a4699532ec875bedddc9746f8e362aa
Actions taken
Tried to run org-ql-find in an org buffer while using vertico
Observed results
I get this error (reformatted for legibility):
Error in post-command-hook (vertico--exhibit):
(wrong-number-of-arguments
((t) (regexp) "Return a snippet of the
current entry's matches for REGEXP."
(if regexp
(progn
(save-excursion
(org-end-of-meta-data t)
(if
(org-at-heading-p) nil
(let* ((end (org-entry-end-position))
(snippets (let* ((--cl-var-- ""))
(while (re-search-forward
regexp end t) (setq
--cl-var--
(concat
--cl-var--
(match-string
0)))
(setq --cl-var--
(concat
--cl-var--
"…"))
(goto-char
(match-end 0)))
--cl-var--)))
(if (string-empty-p snippets)
nil
(concat org-ql-completing-read-snippet-prefix
(replace-regexp-in-string "
+" " " snippets t t))))))))) 0)
Expected results
I expect the command to work with no error.
Backtrace
No response
Etc.
There seems to be a difference between the two built-in options org-ql-completing-read-snippet-function. The simple function does not require an argument whereas the regexp one does. Though the docstring for org-ql-completing-read--snippet-regexp states that the regexp parameter can be nil. This seems be solved by making this argument optional.
However, that may not be the root cause of the issue. I've tried to look through commit history for both org-ql and vertico to determine if there was a recent change, but I cannot find any. Happy to help debug however I can.
This issue was introduced in commit 28f5aa3100497f2ff847cb825628b1f03509dc82 AFAIU and isn't specific to vertico. I think the refactor introduced in that commit (and the following commits) isn't yet complete?
Thanks for reporting.