From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: acm@muc.de, 58343@debbugs.gnu.org
Subject: bug#58343: 29.0.50; ELisp code run in "inconsitent" selected-window state
Date: Wed, 12 Oct 2022 19:13:51 +0000 [thread overview]
Message-ID: <Y0cR78+Kr4H53g0Q@ACM> (raw)
In-Reply-To: <jwvh708lx88.fsf-monnier+emacs@gnu.org>
Hello, Stefan.
On Wed, Oct 12, 2022 at 14:35:33 -0400, Stefan Monnier wrote:
> Hi Alan,
> > One minor problem I see at the moment is that the call to
> > move_minibuffers_onto_frame wasn't moved together with the surrounding
> > code. With its current calling convention, it needs to be called
> > _after_ selected_frame has been set, because it uses selected_frame.
> Aha!
> > Is there any reason this function call was left where it was?
> I was afraid that swapping `move_minibuffers_onto_frame` and
> if (EQ (f->selected_window, f->minibuffer_window)
> /* The following test might fail if the mini-window contains a
> non-active minibuffer. */
> && NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt)))
> {
> Lisp_Object w = call1 (Qget_mru_window, frame);
> if (WINDOW_LIVE_P (w)) /* W can be nil in minibuffer-only frames. */
> Fset_frame_selected_window (frame, w, Qnil);
> }
> would not result in the same final result, e.g. because the name
> "move_minibuffers_onto_frame" suggests it might change the result of
> `XWINDOW (f->minibuffer_window)->contents`.
Yes, I suppose you're right.
> > Or could it just be moved, too? Otherwise, its calling convention
> > will need to be adapted.
> The patch below refrains from moving it and passes it the to-be-selected
> frame as argument instead.
Yes. That's a better solution than moving the function call around,
particularly given that there're are only two calls to it, both in
frame.c.
Just one small thing: the name sf is a bad name for a Lisp_Object -
there's a de facto convention in minibuf.c and frame.c that f, sf, and
of, etc are struct *frame's, and selected_frame, frame, etc., are
Lisp_Object's which are frames. In fact sf is used as a struct *frame
elsewhere in minibuf.c.
Let me guess - originally this sf was a struct *frame, but got changed
to a Lisp_Object when it became clear that it was needed to set MB_frame
with. ;-)
> Stefan
[ .... ]
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2022-10-12 19:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 0:06 bug#58343: 29.0.50; ELisp code run in "inconsitent" selected-window state Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-12 18:08 ` Alan Mackenzie
2022-10-12 18:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-12 19:13 ` Alan Mackenzie [this message]
2022-10-12 21:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y0cR78+Kr4H53g0Q@ACM \
--to=acm@muc.de \
--cc=58343@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).