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

Sly's cached completion table list is being destructively modified by Corfu #557

Open
lapinskim opened this issue Jan 6, 2023 · 0 comments · May be fixed by #558
Open

Sly's cached completion table list is being destructively modified by Corfu #557

lapinskim opened this issue Jan 6, 2023 · 0 comments · May be fixed by #558

Comments

@lapinskim
Copy link

With Corfu enabled in common-lisp mode when completing at point, when the first candidate is equal to prompt, Corfu errors out with:
Error in post-command-hook (corfu--post-command): (args-out-of-range 0 0).

This can be observed simply by trying to complete after car or not

I tracked this to the function corfu--move-to-front which uses delq on the list which references the cached Sly's completion table, effectively setting the first element to nil. See minad/corfu#285 for the reference.

As Corfu's maintainer kindly pointed out in the above mentioned issue, this seems to be the default Emacs behavior, that returned completion list can be destructively modified by a completion UI. For reference, this can be seen in the function completion-all-sorted-completions in minibuffer.el:
https://github.com/emacs-mirror/emacs/blob/15fc7b3cde92e420f48dfe188251e6af4d832af5/lisp/minibuffer.el#L1640-L1661

The easiest solution might be to return a copy of the cached completion candidate list.

Thank you for your time!

@lapinskim lapinskim linked a pull request Jan 6, 2023 that will close this issue
lapinskim added a commit to lapinskim/sly that referenced this issue Jan 6, 2023
Copy the returned all-completions list so that it could be later
destructively modified by the completion UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant