all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: al@petrofsky.org, rudalics@gmx.at, Eli Zaretskii <eliz@gnu.org>,
	63967@debbugs.gnu.org
Subject: bug#63967: 28.2; switch-to-buffer in normal window fails if minibuffer window is active
Date: Sat, 10 Jun 2023 19:42:04 +0000	[thread overview]
Message-ID: <ZITSDEeJo1DclcKR@ACM> (raw)
In-Reply-To: <jwv7csbz5et.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Sat, Jun 10, 2023 at 11:49:43 -0400, Stefan Monnier wrote:
> Hi Alan,

> Could you explain why/when we need to call `Fset_frame_selected_window`
> in the code below:

> >   static void
> >   minibuffer_unwind (void)
> >   {
> >     struct frame *f;
> >     struct window *w;
> >     Lisp_Object window;
> >     Lisp_Object entry;
> >
> >     if (NILP (exp_MB_frame)) return; /* "Can't happen." */
> >     f = XFRAME (exp_MB_frame);
> >     window = f->minibuffer_window;
> >     w = XWINDOW (window);
> >     if (FRAME_LIVE_P (f))
> >       {
> > 	/* minibuf_window = sf->minibuffer_window; */
> > 	if (!NILP (w->prev_buffers))
> > 	  {
> > 	    entry = Fcar (w->prev_buffers);
> > 	    w->prev_buffers = Fcdr (w->prev_buffers);
> > 	    set_window_buffer (window, Fcar (entry), 0, 0);
> > 	    Fset_window_start (window, Fcar (Fcdr (entry)), Qnil);
> > 	    Fset_window_point (window, Fcar (Fcdr (Fcdr (entry))));
> > 	    /* set-window-configuration may/will have unselected the
> > 	       mini-window as the selected window.  Restore it. */
> > 	    Fset_frame_selected_window (exp_MB_frame, window, Qnil);  <<<<<<<<<
> > 	  }
> > 	else
> > 	  set_window_buffer (window, nth_minibuffer (0), 0, 0);
> >       }
> >   }

> I understand why we do the `set_window_buffer` and set its start and
> point, but I can't see why we'd need to select the mini-window:
> presumably if it needed to be (re)selected that should have been handled
> by the window-config save&restore, no?

There was a problem with the restoring of the window configuration
selecting a window other than the minibuffer; that is in circumstances
where the minibuffer window should have ended up being selected.

Fset_window_configuration seems to be the troublesome function in this
scenario.  As well as setting the window configuration, it also selects
a window.

Perhaps we should modify the minibuffer code to note which window should
be current after the completion or abortion of the minibuffer read
action.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2023-06-10 19:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 21:32 bug#63967: 28.2; switch-to-buffer in normal window fails if minibuffer window is active Al Petrofsky
2023-06-09 11:16 ` Eli Zaretskii
2023-06-09 15:08   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09 16:09     ` Eli Zaretskii
2023-06-09 19:18       ` Eli Zaretskii
2023-06-10 15:49         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-10 19:42           ` Alan Mackenzie [this message]
2023-06-11  5:03             ` Eli Zaretskii
2023-06-11 13:40               ` Alan Mackenzie
2023-06-11 13:53                 ` Eli Zaretskii
2023-06-13 18:43                   ` Eli Zaretskii
2023-06-13 21:36                     ` Alan Mackenzie
2023-06-14 12:15                       ` Eli Zaretskii
2023-06-15 10:25                         ` Alan Mackenzie
2023-06-17 11:31                         ` Alan Mackenzie
2023-06-17 13:08                           ` Eli Zaretskii
2023-06-17 13:52                           ` martin rudalics
2023-06-17 16:23                             ` Alan Mackenzie
2023-06-17 18:46                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-11 14:35                 ` Drew Adams
2023-06-11 16:01                   ` Alan Mackenzie
2023-06-12  7:17                     ` martin rudalics
2023-06-12 12:04                       ` Eli Zaretskii
2023-06-11 16:12                   ` Eli Zaretskii
2023-06-09 16:52   ` Gregory Heytings
2023-06-09 17:21     ` Eli Zaretskii
2023-06-09 20:04       ` Gregory Heytings
2023-06-10  5:59         ` Eli Zaretskii
2023-06-10  6:39           ` Gregory Heytings
2023-06-10  6:45             ` Eli Zaretskii
2023-06-10  8:45               ` Gregory Heytings
2023-06-10  6:52   ` martin rudalics
2023-06-10  8:28     ` Eli Zaretskii
2023-06-10 14:51       ` martin rudalics
2023-06-10 17:09         ` Eli Zaretskii
2023-06-11  8:10           ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZITSDEeJo1DclcKR@ACM \
    --to=acm@muc.de \
    --cc=63967@debbugs.gnu.org \
    --cc=al@petrofsky.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.