[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: C-x C-f in two frames -> "user minibuffer while in minibuffer": Bug?
From: |
Drew Adams |
Subject: |
RE: C-x C-f in two frames -> "user minibuffer while in minibuffer": Bug? |
Date: |
Thu, 9 Jun 2005 09:22:44 -0700 |
If I open a second frame, then do C-x C-f in one of them and press
tab so that the window is split and I get a *Completions* buffer in
one frame, and when I then select the second frame and do a C-x C-f
there, I don't get another *Completions* buffer there, but an error
message that appears in the first frame:
"Command attempted to use minibuffer while in minibuffer"
This happens with standard settings, on the GNU/Linux port as well as
on Carbon, no matter what display-buffer-reuse-frames is.
Is that a bug?
Others have explained what's happening wrt minibuffer input. Here's some
more info that might help:
The *Completions* buffer is a bit special, in that its input is directed to
the minibuffer. When it is in a separate frame, the frame focus needs to be
redirected to the minibuffer explicitly, I've found. I do this:
;; Use `my-display-*Completions*-frame' to display *Completions* buffer
(add-to-list
'special-display-buffer-names
(list "*Completions*" 'my-display-*Completions*-frame))
(defun my-display-*Completions*-frame (buf &optional args)
"Display *Completions* buffer in its own frame.
`special-display-function' is used to do the actual displaying.
Completion input events are redirected to `my-minibuffer-frame'."
(let (return-window)
(setq return-window
(select-window (funcall special-display-function buf args)))
(raise-frame)
(redirect-frame-focus (selected-frame) my-minibuffer-frame)
return-window))
The key line is the second-to-last: redirect-frame-focus.
The value of variable `my-minibuffer-frame' is a standalone minibuffer
(only) frame. (For the complete code, see
http://www.emacswiki.org/elisp/oneonone.el. See also
http://www.emacswiki.org/elisp/elect-mbuf.el for code that removes the
*Completions* frame when you are done with it.)
HTH,
Drew