prescient.el icon indicating copy to clipboard operation
prescient.el copied to clipboard

completing-read on non-string inputs raises wrong-type-argument error

Open martenlienen opened this issue 4 years ago • 2 comments

Hi, the following code produces a (wrong-type-argument sequencep gpu) with ivy and prescient.

(let ((candidates '((default "julia") (remote "ssh"))))
  (completing-read "julia binary" candidates))

The problem is that https://github.com/raxod502/prescient.el/blob/47fef02cc32b1fcd8ca97ec801572f5ba91a1a2a/prescient.el#L475-L476 assumes that the candidates are strings or something that you can call length on. This precludes prescient from working on integer or symbol candidates. One simple fix would be to convert all candidates to strings but since the code seems to be quite performance-optimized that may be unacceptable.

Best, Marten

martenlienen avatar Oct 25 '20 16:10 martenlienen

That sounds like a bug in Ivy, it should be converting candidates to strings before passing them to the sort function. Selectrum does not have this problem.

raxod502 avatar Oct 25 '20 18:10 raxod502

I can reproduce your problem though, to be clear. See https://github.com/raxod502/prescient.el/issues/65.

raxod502 avatar Oct 25 '20 18:10 raxod502