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: Mon, 16 May 2022 20:52:42 +0000 Message-ID: References: <838rr4kq56.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="2686"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55412@debbugs.gnu.org, tanzer@swing.co.at, acm@muc.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 16 23:17:43 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 1nqi63-0000TC-EX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 May 2022 23:17:43 +0200 Original-Received: from localhost ([::1]:34874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqi62-0006xa-3C for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 May 2022 17:17:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqhiA-0007FG-Ds for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 16:53:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqhiA-0006aW-5A for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 16:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqhiA-0005EB-3H for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 16:53: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: Mon, 16 May 2022 20:53:02 +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.165273437220080 (code B ref 55412); Mon, 16 May 2022 20:53:02 +0000 Original-Received: (at 55412) by debbugs.gnu.org; 16 May 2022 20:52:52 +0000 Original-Received: from localhost ([127.0.0.1]:55134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqhhz-0005Dn-QZ for submit@debbugs.gnu.org; Mon, 16 May 2022 16:52:52 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:64510 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nqhhx-0005Da-Ji for 55412@debbugs.gnu.org; Mon, 16 May 2022 16:52:50 -0400 Original-Received: (qmail 60800 invoked by uid 3782); 16 May 2022 20:52:43 -0000 Original-Received: from acm.muc.de (p4fe15b7d.dip0.t-ipconnect.de [79.225.91.125]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 16 May 2022 22:52:43 +0200 Original-Received: (qmail 9791 invoked by uid 1000); 16 May 2022 20:52:42 -0000 Content-Disposition: inline In-Reply-To: <838rr4kq56.fsf@gnu.org> 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:232413 Archived-At: Hello, Eli. On Sat, May 14, 2022 at 19:58:13 +0300, Eli Zaretskii wrote: > > Date: Sat, 14 May 2022 15:45:10 -0000 > > From: Christian Tanzer > > ;;; In Emacs 28.1, using ':eval' in 'frame-title-format' doesn't work like it > > ;;; used to in Emacs 27 and earlier. In fact, it is completely broken, if one > > ;;; uses a frame-parameter in ':eval'. > > ;;; > > ;;; The following elisp snippet demonstrates the problem in an Emacs 28.1 > > ;;; instance started with 'emacs -Q' [ .... ] > > ;;; In Emacs 27 and earlier, that is exactly what happens. Selecting a > > ;;; different frame doesn't change the titles of all other frames. > > ;;; In Emacs 28.1, all frames show the same frame title, with the last one > > ;;; selected determining which one is shown for the bunch of them. Changing to > > ;;; a different frame changes the titles of all frames to the title of the > > ;;; newly selected one. > Thank you for your report. > Alan, this is due to one of the changes introduced for the > minibuffer-follows-selected-frame feature. Specifically, commit > 7c2ebf6 made a change in gui_consider_frame_title which causes this > regression. If I revert a part of that commit as shown below: > diff --git a/src/xdisp.c b/src/xdisp.c > index 6963935..9740e6b 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -12796,8 +12796,9 @@ 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)); > + 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; > then the problem goes away. Yes. It is clear that that Fselect_window call is needed. > The log message of that commit says about this part: > * src/xdisp.c (gui_consider_frame_title): Remove redundant Fselect_window, > which caused an unwanted frame switch. Amend the arguments to > format_mode_line_unwind_data to match. > As you see, the call to select-window is not redundant, because > without it the frame's title cannot reference the frame-parameters of > that frame. > Do you remember why the frame switch here was "unwanted"? What > bad things happen if we restore the removed code? I think I've managed to reconstruct why I made this part of the change. With the Fselect_window call in place: (i) When minibuffer-follows-selected-frame is nil, and the minibuffer is the current window before switching frames with C-x 5 o, it remains the current window on returning to the first frame. (ii) When minibuffer-follows-selected-frame is t (the default) and other circumstances are as in (i), the minibuffer is no longer the selected window on returning to the first frame. I wanted to fix this inconsistency, I think. Clearly, this inconsistency is less important than frame-title-format not working. May I suggest that one of us applies your patch immediately to the release branch. I will then attempt to find a less harmful way of fixing that inconsistency, and will take direction from you which branch it should be committed to. > Thanks. -- Alan Mackenzie (Nuremberg, Germany).