[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stop frames stealing eachothers' minibuffers!
From: |
Alan Mackenzie |
Subject: |
Re: Stop frames stealing eachothers' minibuffers! |
Date: |
Sat, 21 Nov 2020 10:27:51 +0000 |
Hello, Martin.
On Sat, Nov 21, 2020 at 10:02:15 +0100, martin rudalics wrote:
> >> (setq default-frame-alist '((minibuffer . nil)))
> >> (defun foo ()
> >> (interactive)
> >> (read-from-minibuffer "...?")
> >> (insert (format "%s" (selected-frame))))
> >> insert (foo) into *scratch* and type C-x C-e. After answering the
> >> prompt this gets me #<frame *Minibuf-1* 0x36132d8>. Do the same with
> >> Emacs 27 and it will get you the *scratch* frame.
> > Yes, I see this (except for the Emacs 27 bit which I haven't tried,
> > yet).
> > However, if I type (frame-list) into *scratch* and do C-x C-e I get only
> > one frame in the list, and it has the same address in the #<frame ...>
> > output as the " *Minibuf-1* 0xxxx" output.
> You have to _load_ the
> (setq default-frame-alist '((minibuffer . nil)))
> part, it won't work after your default initial frame has been already
> set up. Run Emacs via something like
> emacs -Q --load ~/foo.el
> to see the effect ....
OK, I've got it now.
[ .... ]
> But indeed, with Emacs -Q executing 'foo' defined as
> (defun foo ()
> (interactive)
> (read-from-minibuffer "...?")
> (insert (format "window: %s .. frame: %s" (selected-window)
> (selected-frame))))
> reveals another aspect broken by your change. The values reported by
> 'selected-window' and 'select-frame' do not match up any more (unless
> our masochistic way of printing frame names hides an important detail).
I'll look at that later. I'll look at the other things below [snipped]
later, too. I'm a bit short of time today.
[ .... ]
Here's a quick and dirty patch to minibuf.c which appears to fix the bug,
but I haven't given it much testing yet:
diff --git a/src/minibuf.c b/src/minibuf.c
index 464e3018f7..5312dc9805 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -508,7 +508,14 @@ read_minibuf (Lisp_Object map, Lisp_Object initial,
Lisp_Object prompt,
mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
if (!EQ (mini_frame, selected_frame))
record_unwind_protect (restore_window_configuration,
- Fcons (Qt,
+ Fcons (
+ /* If we're at top minibuffer level in a
+ minibuffer-only frame, arrange for the
+ frame later to be switched back. */
+ (FRAME_MINIBUF_ONLY_P (XFRAME (mini_frame))
+ && minibuf_level <= 1)
+ ? Qnil
+ : Qt,
Fcurrent_window_configuration (mini_frame)));
/* If the minibuffer is on an iconified or invisible frame,
> martin
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Stop frames stealing eachothers' minibuffers!, (continued)
- Re: Stop frames stealing eachothers' minibuffers!, Alan Mackenzie, 2020/11/19
- Re: Stop frames stealing eachothers' minibuffers!, Andrii Kolomoiets, 2020/11/19
- Re: Stop frames stealing eachothers' minibuffers!, Alan Mackenzie, 2020/11/19
- Re: Stop frames stealing eachothers' minibuffers!, martin rudalics, 2020/11/20
- Re: Stop frames stealing eachothers' minibuffers!, Alan Mackenzie, 2020/11/20
- Re: Stop frames stealing eachothers' minibuffers!, Stefan Monnier, 2020/11/20
- Re: Stop frames stealing eachothers' minibuffers!, martin rudalics, 2020/11/21
- Re: Stop frames stealing eachothers' minibuffers!,
Alan Mackenzie <=
- Re: Stop frames stealing eachothers' minibuffers!, martin rudalics, 2020/11/21
- Re: Stop frames stealing eachothers' minibuffers!, Alan Mackenzie, 2020/11/21
- Re: Stop frames stealing eachothers' minibuffers!, martin rudalics, 2020/11/21
- Re: Stop frames stealing eachothers' minibuffers!, Alan Mackenzie, 2020/11/22
- Re: Stop frames stealing eachothers' minibuffers!, Stefan Monnier, 2020/11/22
- Re: Stop frames stealing eachothers' minibuffers!, Alan Mackenzie, 2020/11/22
- Re: Stop frames stealing eachothers' minibuffers!, Stefan Monnier, 2020/11/22
- Re: Stop frames stealing eachothers' minibuffers!, martin rudalics, 2020/11/22
- Re: Stop frames stealing eachothers' minibuffers!, Alan Mackenzie, 2020/11/22
- Re: Stop frames stealing eachothers' minibuffers!, martin rudalics, 2020/11/23