Subject: bug#10053: Wrong use of minibuffer-completion-table in tmm-add-prompt

From: Thierry Volpiatto <[email-masked]>
Date: Wed, 16 Nov 2011 09:27:49 +0100

Stefan Monnier <[email-masked]> writes:

> But the error is that tmm-add-prompt should not be run in that case.
> It should only be run when you use tmm-prompt or tmm-menubar.
Yes, but when calling `menu-bar-open' with menu-bar-mode==nil, it calls
`x-menu-bar-open' which calls `tmm-menubar' right?
And in my case here `tmm-add-prompt' is called and error occur.
I think it would be safer to check if `minibuffer-completion-table' is a
table or a (a)list, and run the appropriate code to handle both cases.
Though `all-completions' can handle both cases here i think.  

I still not understand the purpose of `tmm-add-prompt', what does it
want to complete here? A list of buffers? Why?

> I see a small error in tmm.el which could explain why tmm-add-prompt
> lingers on minibuffer-setup-hook longer than desired.  I've installed the
> patch below, please see if it helps.
Your patch works with `anything-completion-mode' disabled, but as soon i
turn it on, `tmm-add-prompt' is called and same error occur:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument listp closure)
  car(closure)
  mapcar(car (closure (t) (&rest args)
[...]

  tmm-add-prompt()
--8<---------------cut here---------------end--------------->8---

`anything-completion-mode' is only using his own
`completing-read-function'.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997