From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#55412: 28.1; In Emacs 28.1, using ':eval' in 'frame-title-format' doesn't work properly Date: Wed, 18 May 2022 15:49:36 +0000 Message-ID: References: <838rr4kq56.fsf@gnu.org> <87d23565-b8ba-3b08-0d10-068be3b0c5fd@gmx.at> <83leuzf4zk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3971"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55412@debbugs.gnu.org, tanzer@swing.co.at, Eli Zaretskii , acm@muc.de To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 18 17:51:36 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrLxX-0000rb-VY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 May 2022 17:51:36 +0200 Original-Received: from localhost ([::1]:51124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nrLxW-0002o0-HS for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 May 2022 11:51:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrLw2-0002BD-CE for bug-gnu-emacs@gnu.org; Wed, 18 May 2022 11:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nrLw2-0008GW-2U for bug-gnu-emacs@gnu.org; Wed, 18 May 2022 11:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nrLw2-0002Zl-0H for bug-gnu-emacs@gnu.org; Wed, 18 May 2022 11:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 May 2022 15:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55412 X-GNU-PR-Package: emacs Original-Received: via spool by 55412-submit@debbugs.gnu.org id=B55412.16528889859873 (code B ref 55412); Wed, 18 May 2022 15:50:01 +0000 Original-Received: (at 55412) by debbugs.gnu.org; 18 May 2022 15:49:45 +0000 Original-Received: from localhost ([127.0.0.1]:33285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nrLvk-0002ZB-UU for submit@debbugs.gnu.org; Wed, 18 May 2022 11:49:45 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:46697 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nrLvj-0002Yy-6W for 55412@debbugs.gnu.org; Wed, 18 May 2022 11:49:43 -0400 Original-Received: (qmail 82461 invoked by uid 3782); 18 May 2022 15:49:37 -0000 Original-Received: from acm.muc.de (p4fe15a4c.dip0.t-ipconnect.de [79.225.90.76]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 18 May 2022 17:49:36 +0200 Original-Received: (qmail 19633 invoked by uid 1000); 18 May 2022 15:49:36 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232588 Archived-At: Hello, Martin and Eli. On Wed, May 18, 2022 at 17:01:43 +0200, martin rudalics wrote: > >> When I type M-:, save the expression to evaluate from some other frame, > >> and the subsequent yank inserts that expression into a normal buffer > >> instead of the minibuffer, the resulting behavior does not constitute a > >> less important inconsistency but an annoying regression. This is one of > >> the things that used to work "ever since". > > Can you tell more about the inconsistency you get in this scenario? > > I'm afraid I don't follow the description and therefore cannot try > > reproducing it myself. > Suppose I want to calculate the sum of two numbers: number-1 is shown in > a buffer on frame-1, number-2 is show in a buffer on frame-2. I start > typing M-: (+ on frame-1 then I do C-x o, mark number-1, type M-w, C-x o > and C-y to yank number-1 into the minibuffer. Then I add a space to the > minibuffer, type C-x 5 o to go to frame-2, mark number-2, type M-w and > C-x 5 o to get back to frame-1. > Ever since, that last C-x 5 o got me to the minibuffer window. With the > proposed change, that C-x 5 o will get me to the window of number-1 and > I have to manually select the minibuffer window to yank number-2 there. Please try the following patch, which may solve the above problem without hurting the bug fix. diff --git a/src/frame.c b/src/frame.c index ccac18d23c..7869726850 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1564,6 +1564,10 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) last_nonminibuf_frame = XFRAME (selected_frame); + if (EQ (f->selected_window, f->minibuffer_window) + && NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt))) + Fset_frame_selected_window (frame, Fframe_first_window (frame), Qnil); + Fselect_window (f->selected_window, norecord); /* We want to make sure that the next event generates a frame-switch diff --git a/src/frame.h b/src/frame.h index 0b8cdf62de..87c44dd22b 100644 --- a/src/frame.h +++ b/src/frame.h @@ -123,7 +123,8 @@ #define EMACS_FRAME_H /* This frame's selected window. Each frame has its own window hierarchy and one of the windows in it is selected within the frame. - The selected window of the selected frame is Emacs's selected window. */ + The selected window of the selected frame is Emacs's selected window. + This window may be the mini-window of the frame. */ Lisp_Object selected_window; /* This frame's selected window when run_window_change_functions was diff --git a/src/minibuf.c b/src/minibuf.c index 847e7be5ad..66aed0ad70 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -203,14 +203,6 @@ move_minibuffers_onto_frame (struct frame *of, bool for_deletion) zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window); if (for_deletion && XFRAME (MB_frame) != of) MB_frame = selected_frame; - if (!for_deletion - && MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (of)))) - { - Lisp_Object old_frame; - XSETFRAME (old_frame, of); - Fset_frame_selected_window (old_frame, - Fframe_first_window (old_frame), Qnil); - } } } diff --git a/src/xdisp.c b/src/xdisp.c index 6963935666..7e166121df 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12796,8 +12796,10 @@ gui_consider_frame_title (Lisp_Object frame) mode_line_noprop_buf; then display the title. */ record_unwind_protect (unwind_format_mode_line, format_mode_line_unwind_data - (NULL, current_buffer, Qnil, false)); + (f, current_buffer, selected_window, false) + /* (NULL, current_buffer, Qnil, false) */); + Fselect_window (f->selected_window, Qt); set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->contents)); fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; > martin -- Alan Mackenzie (Nuremberg, Germany).