Subject: bug#11715: 24.1; Error in post-command-hook: wrong-number-of-arguments - read-file-internal

From: "Drew Adams" <[email-masked]>
Date: Sat, 23 Jun 2012 07:50:55 -0700

> > What would construct a function of no args that is essentially
> > `read-file-name-internal' and put it on `post-command-hook'
> 
> As I said, it is *not* put on post-command-hook:
> it is run by Icomplete's post-command-hook

Don't know what you're insisting about.  I was clear about that:

   Icomplete runs only `icomplete-exhibit' on
   `icomplete-post-command-hook' (hence on `post-command-hook')".
   Icomplete runs its hook on `post-command-hook'...

(add-hook 'post-command-hook
	     (lambda () (run-hooks 'icomplete-post-command-hook))
	     nil t)

> so the error could be because that
> function was put in minibuffer-completion-table or
> minibuffer-completion-predicate (and hence called by
> icomplete-completions), or even on icomplete-post-command-hook.
> Can you check some of those variables?

I have checked them and did not find anything.  But the problem does not occur
all the time.  And, IIRC, it seems to occur once and then go away.  (I'm not
certain of that.)

And as you know it is difficult (~impossible) to use the debugger with the
Icomplete code.

FWIW, I'm guessing also that if that function were somehow put into
`minibuffer-completion-*' then I would see an error message sooner and in other
places.

> If you can find a way to trigger the problem with
> M-: (run-hooks 'icomplete-post-command-hook) RET then we 
> could debug it a bit more easily (e.g. get a backtrace, use edebug, ...).

Agreed.  If I could.  So far, I don't know how to repro the problem.

FWIW, I don't see the error right now.  I try `M-x forw' (to get Icomplete to
kick in), and then I try `M-: (run-hooks 'icomplete-post-command-hook)'.  It
does not appear to do anything (besides show the completions), and it returns
nil.  And if I instead do `M-: icomplete-post-command-hook' it says only
`(icomplete-exhibit)', as expected.

I will try to keep my eyes open and see if I can find out anything more the next
time I see the error.  Dunno what else to look at.  I realize that you cannot do
more at this point either.