Subject: bug#11105: 24.0.94; (wrong-type-argument strinp (eval.c))

From: "Drew Adams" <[email-masked]>
Date: Tue, 2 Oct 2012 16:04:20 -0700

d> I get this error message from time to time - have to go to 
d> *Messages* to find it, so something must be preventing it
d> from surfacing:
d>  
d> Error in post-command-hook (#[nil \300\301!\207 [run-hooks
d> icomplete-post-command-hook] 2]): (wrong-type-argument 
d> stringp (eval.c))
d>  
d> Sorry, but I have no more info than that.  I tried looking at
d> `icomplete-exhibit', which is the only function on
d> `icomplete-post-command-hook', to see if I could guess what 
d> the problem is, but I didn't succeed.  Feel free to close this,
d> if it doesn't help you find a problem.

sm> My crystal ball told me it could be a mis-applied completion
sm> predicate (depending on the kind of completion-table (list of
sm> strings, alist, obarray, hashtable), the predicate is either
sm> passed a string, a cons-cell, or even two arguments), but I
sm> didn't notice any obvious risky uses of the predicate in
sm> icomplete, so the problem might be elsewhere (and just happens
sm> to show up in icomplete because icomplete calls completion more
sm> often).

How right you were, Stefan.

I finally located the problem, which was in my code.

What the problem was, FYI:

I have a modified version of icomplete-completions, which does not use
`completion--field-metadata', `completion-all-sorted-completions', LAST, or
BASE-SIZE.

The second `if' clause, which calls `completion-try-completions', raised an
error when its COMPS arg was a function (not sure why), so I changed the code to
use `try-completion' instead.

The bug was not here, but this is why I was seeing the problem from icomplete:
because icomplete was the only function that actually used `try-completion' with
the code that was bugged.

That other, bugged code was calling `completing-read' with a function-valued
COLLECTION arg, and the final act of that function called `try-completion' on a
string, a collection of singleton string lists, and the original predicate arg.
The predicate here should however expect a singleton list as arg, not a string.
The fix was to change the predicate.

That code never used the `try-completion' case (COMPLETION-MODE = nil), so I
never saw the bug except from icomplete (which in my version calls
`try-completion').

I will close this bug.