Skip to content

Error when using completion-preview-mode and completion-preview-complete #664

@verdammelt

Description

@verdammelt

Minimal replication with emacs -Q (assuming sly installed at "~/.emacs/elpa/sly-20240809.2119")

Evaluate

(global-completion-preview-mode 1)
(toggle-debug-on-error)
(push "~/.emacs.d/elpa/sly-20240809.2119" load-path)
(load-library "sly")
(sly "sbcl")

Then type (form into the REPL - completion-preview-mode will show first possible match, use completion-preview-complete (bound to M-i by default) to list all completions and get the following backtrace:

Debugger entered--Lisp error: (invalid-function ("format" "formatter" "force-output"))
  ("format" "formatter" "force-output")(nil nil sly--identify)
  sly--completion-in-region-function(#<marker at 463 in *sly-mrepl for sbcl*> 466 ("format" "formatter" "force-output") nil)
  apply(sly--completion-in-region-function (#<marker at 463 in *sly-mrepl for sbcl*> 466 ("format" "formatter" "force-output") nil))
  #f(compiled-function (oldfun &rest args) #<bytecode -0x257aee4dacd0d45>)(#[128 "\301\302\300!\2\"\207" [completion-in-region-function apply default-value] 4 advice--forward] #<marker at 463 in *sly-mrepl for sbcl*> 466 ("format" "formatter" "force-output") nil)
  apply(#f(compiled-function (oldfun &rest args) #<bytecode -0x257aee4dacd0d45>) #[128 "\301\302\300!\2\"\207" [completion-in-region-function apply default-value] 4 advice--forward] (#<marker at 463 in *sly-mrepl for sbcl*> 466 ("format" "formatter" "force-output") nil))
  #f(advice #f(compiled-function (oldfun &rest args) #<bytecode -0x257aee4dacd0d45>) :around #[128 "\301\302\300!\2\"\207" [completion-in-region-function apply default-value] 4 advice--forward] ((name . sly--setup-completion)))(#<marker at 463 in *sly-mrepl for sbcl*> 466 ("format" "formatter" "force-output") nil)
  completion-in-region(#<marker at 463 in *sly-mrepl for sbcl*> 466 ("format" "formatter" "force-output") nil)
  completion-at-point()
  completion-preview-complete()
  funcall-interactively(completion-preview-complete)
  call-interactively(completion-preview-complete nil nil)
  command-execute(completion-preview-complete)

It appears that sly--completion-in-region-function expects a function as its third argument but is given a list of matches here.

What is the responsibility of this function argument? I am thinking I might at least hack together a fix with an advice...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions