Subject: RE: bug#16661: 24.3.50; standalone minibuffer frame gets renamed with name of aother frame

From: Drew Adams <[email-masked]>
Date: Sat, 22 Feb 2014 08:41:56 -0800 (PST)

> I'm confused:

Probably not as much as I.

> window-setup-hook is called only once, as part of Emacs
> startup.

Yes, and I'm sorry that I do not recall just why I do that add-hook.
I have used it ever since I've used a standalone minibuffer frame,
I believe, but I can try without it.  I have this comment next
to that code, but again, I do not recall what the problem was:

;;; A HACK FOR WINDOWS

> Are you saying that all these cases of renaming happened
> during Emacs startup, and only at that time?  I somehow decided,
> probably erroneously, that the renaming randomly happened during a
> running session.

What I have observed, irrespective of the debugging output, is that:

a. Initially, after startup, things are normal wrt frame names.
b. Sometime later, in the middle of a session, the bug arises.

The order of what I do at startup is this:

1. Rename the newly created minibuffer frame to the name it should
have always.  (I do this in oneonone.el.)

2. Do the add-hook for `window-setup-hook'.

> > Why should the `buffer-name' of the minibuffer frame be
> > different from the frame name, for the minibuffer frame?
> 
> AFAIK, buffer-name in the minibuffer always returns the name of the
> buffer which caused minibuffer to be entered.  Anything else would be
> highly confusing, e.g. "M-: (buffer-name) RET" surely must return the
> name of the invoking buffer.

Not if you select the standalone minibuffer frame (e.g., click mouse-1
on its title bar).  In that case, `M-: (buffer-name)' shows the
minibuffer's buffer name: ` *Minibuf-N*', N=0,1,2...

This is as it should be.  No problem with that.

> IOW, I think that buffer-name in the minibuffer is unreliable, if you
> want to get the name of the minibuffer itself.

The buffer displayed in the minibuffer window is typically named
` *Minibuf-N*', N=0,1,2...  It is still named this way with my
setup.  The only thing I change is the `name' parameter of the
frame.

I will try removing the `window-setup-hook' renaming, to see whether
that makes a difference.