From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#55412: 28.1; In Emacs 28.1, using ':eval' in 'frame-title-format' doesn't work properly Date: Sat, 14 May 2022 19:58:13 +0300 Message-ID: <838rr4kq56.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31828"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55412@debbugs.gnu.org To: tanzer@swing.co.at, Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 14 18:59:21 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 1npv6u-0008Bw-P8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 May 2022 18:59:20 +0200 Original-Received: from localhost ([::1]:49042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npv6t-0006Sz-Ns for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 May 2022 12:59:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npv6l-0006SL-09 for bug-gnu-emacs@gnu.org; Sat, 14 May 2022 12:59:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53539) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npv6b-0003kR-Q1 for bug-gnu-emacs@gnu.org; Sat, 14 May 2022 12:59:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1npv6b-000784-Q3 for bug-gnu-emacs@gnu.org; Sat, 14 May 2022 12:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 May 2022 16:59: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.165254752327368 (code B ref 55412); Sat, 14 May 2022 16:59:01 +0000 Original-Received: (at 55412) by debbugs.gnu.org; 14 May 2022 16:58:43 +0000 Original-Received: from localhost ([127.0.0.1]:47436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npv6I-00077M-I0 for submit@debbugs.gnu.org; Sat, 14 May 2022 12:58:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npv6G-000778-Jg for 55412@debbugs.gnu.org; Sat, 14 May 2022 12:58:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57226) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npv62-0003gO-Mm; Sat, 14 May 2022 12:58:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=pJMaGHDKuI3PIG0JntY1zS6kKCnWp6XFyeEpCrRE6o8=; b=Rm1G3OyMN2nh uIBTCvRyDBUJb19aMPzSYTBqc259GkM7I0nptWt3uiet3/xB6DWehE2znAHZTkl6X4lpXblynisD1 E9ZYgL8fMF2YO35a+vuJuw8DZP4QS2zi2h+2qisZsP/ePlWX57e456AGZw2I+yhe3Hq26eU57RlUJ Hah3yhti/chk/Q3yDF4Mt+W0nphefvN4MXcWJ9h/hNMMZ3gt9ZTVHfQ5uoC94DCEgSa2h6fsrWUqT TQ9Jdxn7tZnWQzyQ3/PrK/Xx1kpb0S5sH06ScAoVfGOQekNQTCpCTJ7cfGFqPfubCkstL1UU4SOdP fDyDb/7TQWyVgfJNct+/dg==; Original-Received: from [87.69.77.57] (port=4826 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npv61-0004Y4-Qw; Sat, 14 May 2022 12:58:26 -0400 In-Reply-To: (message from Christian Tanzer on Sat, 14 May 2022 15:45:10 -0000) 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:232256 Archived-At: > 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 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? Thanks.