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: Sun, 15 May 2022 09:48:37 +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="36922"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55412@debbugs.gnu.org, tanzer@swing.co.at To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 15 11:49:11 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 1nqAsA-0009Nx-3R for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 May 2022 11:49:10 +0200 Original-Received: from localhost ([::1]:57400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqAs8-0001yx-VP for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 May 2022 05:49:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqAs2-0001ya-Ez for bug-gnu-emacs@gnu.org; Sun, 15 May 2022 05:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqAs2-00052W-6O for bug-gnu-emacs@gnu.org; Sun, 15 May 2022 05:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqAs2-0002w0-3x for bug-gnu-emacs@gnu.org; Sun, 15 May 2022 05:49: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: Sun, 15 May 2022 09:49: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.165260812811260 (code B ref 55412); Sun, 15 May 2022 09:49:02 +0000 Original-Received: (at 55412) by debbugs.gnu.org; 15 May 2022 09:48:48 +0000 Original-Received: from localhost ([127.0.0.1]:48564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqArn-0002vY-VR for submit@debbugs.gnu.org; Sun, 15 May 2022 05:48:48 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:38126 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nqArk-0002vJ-Ud for 55412@debbugs.gnu.org; Sun, 15 May 2022 05:48:46 -0400 Original-Received: (qmail 1355 invoked by uid 3782); 15 May 2022 09:48:38 -0000 Original-Received: from acm.muc.de (p4fe157eb.dip0.t-ipconnect.de [79.225.87.235]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 15 May 2022 11:48:38 +0200 Original-Received: (qmail 4178 invoked by uid 1000); 15 May 2022 09:48:37 -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:232293 Archived-At: 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' > > (defun title-suffix () > > (cdr (assoc 'title-suffix (frame-parameters (selected-frame))))) > > (defvar title-prefix "Test") > > (setq frame-title-format (list title-prefix '(:eval (title-suffix)) " %b")) > > ;;; The original frame should show a frame title of 'Test *scratch*' > > (set-frame-parameter (selected-frame) 'title-suffix "") > > ;;; The next frame created should show a frame title of 'Test-xxx *scratch*' > > (make-frame-command) > > (set-frame-parameter (selected-frame) 'title-suffix "-xxx") > > ;;; The third frame created should show a frame title of 'Test-yyy *scratch*' > > (make-frame-command) > > (set-frame-parameter (selected-frame) 'title-suffix "-yyy") > > ;;; 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. > 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 remember vaguely that that call to Fselect_window caused minibuffers to be switched between frames in an unwanted fashion. I've got detailed notes of what I did, still. I'll probably not have much chance to look at the bug today, but should do over the next few days. > Thanks. -- Alan Mackenzie (Nuremberg, Germany).