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

org-ql-find snippet function error with vertico #419

Open
tpeacock19 opened this issue Mar 9, 2024 · 2 comments
Open

org-ql-find snippet function error with vertico #419

tpeacock19 opened this issue Mar 9, 2024 · 2 comments
Assignees
Labels
Milestone

Comments

@tpeacock19
Copy link

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: e41fe90

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.

@9viz
Copy link

9viz commented Mar 10, 2024

This issue was introduced in commit 28f5aa3 AFAIU and isn't specific to vertico. I think the refactor introduced in that commit (and the following commits) isn't yet complete?

@alphapapa
Copy link
Owner

Thanks for reporting.

@alphapapa alphapapa self-assigned this Mar 10, 2024
@alphapapa alphapapa added the bug label Mar 10, 2024
@alphapapa alphapapa added this to the 0.8.6 milestone Mar 10, 2024
@alphapapa alphapapa modified the milestones: 0.8.6, v0.8.7 Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants