Subject: bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))

From: Drew Adams <[email-masked]>
Date: Fri, 3 Jan 2014 14:52:01 -0800 (PST)

> Obviously the list of strings comes from completion-all-completions
> or completion-all-sorted-completions and looks sane.  So the error is
> that some code mistakenly treats the list as a function.

Yes, I said as much, explicitly.

> > Can you identify the code that issues that error message?
> 
> It's the C code that runs `post-command-hook', AFAIK.

I was looking for the function that issued the `invalid-function'
error.  It seems to be `eval_sub' (via `Qinvalid_function').
So no special help there.

So far, my best guess is still that in

(completion-try-completion name comps nil (length name) md)

the list COMPS is for some reason being treated as a function (the
second argument can of course be either).

And I'm still wild-guessing that this somehow has to do with
the caching of the list of completions in variable
`completion-all-sorted-completions'.

Maybe `completion--nth-completion' (called by
`completion-try-completion') for some reason finds 
(completion-metadata-get metadata 'completion--unquote-requote) to be
non-nil, and so calls its TABLE argument, trying to requote?

Not easy to debug this.  I do not see the problem regularly.