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 06:39:32 -0700

> > Error in post-command-hook (#[nil \300\301!\207 [run-hooks
> > icomplete-post-command-hook] 2]): (wrong-number-of-arguments (lambda
> > nil (let ((minibuffer-completing-file-name t))
> > (completion-table-in-turn (quote completion--embedded-envvar-table)
> > (quote completion--file-name-table)))) 3)
> 
> This says that while running icomplete's post-command-hook, someone
> tried to call:
> 
> > (lambda () (let ((minibuffer-completing-file-name t))
> > (completion-table-in-turn (quote completion--embedded-envvar-table)
> > (quote completion--file-name-table))))
> 
> with 3 arguments.
> Now, grepping for minibuffer-completing-file-name, I don't 
> see anywhere where we could build such a function.  Could it come from 
> some unbundled Elisp code (e.g. Icicles)?

Possibly, but I don't see how/where.

The code inside the `let' is the defalias of `read-file-name-internal'.  That
should be some hint to who constructs that function.

Grepping the Icicles (and other 3rd-party code I use) for
`minibuffer-completing-file-name', I do not see anywhere that such a function
(or even something similar) is built.

And grepping for `read-file-name-internal' finds nothing that seems related.

The only place Icicles binds `minibuffer-completing-file-name' to t is in
`icicle-read-file-name', which, after doing some unrelated stuff just binds
`read-file-name-function' to nil and calls `read-file-name' (thus using the
default behavior for `read-file-name').

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

I checked all of this code before filing the bug report, and checked it again
just now.  Any idea?  What would construct a function of no args that is
essentially `read-file-name-internal' and put it on `post-command-hook' (and
apparently in or around icompletion, since I see the error only in that
context)?