From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows Date: Sun, 10 Oct 2021 19:16:38 +0200 Message-ID: <7550236b-9c89-ada8-2305-050799971ec0@gmx.at> References: <77096009-372B-4C7E-9D2C-9FC72C983AA9@taranawireless.com> <717F6316-6D1B-409F-B4C5-41603EB63208@taranawireless.com> <6D2FC628-BF92-4C35-8552-FBBEF0C7FDDC@taranawireless.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------FE9F550DBBF92DCA7569FDED" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3955"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51007@debbugs.gnu.org To: Indrajeet Khandekar Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 10 19:17:11 2021 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 1mZcRi-0000u5-T4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Oct 2021 19:17:10 +0200 Original-Received: from localhost ([::1]:39262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZcRg-0004lG-TA for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Oct 2021 13:17:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZcRb-0004kr-2T for bug-gnu-emacs@gnu.org; Sun, 10 Oct 2021 13:17:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44184) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZcRa-0003Pc-Qj for bug-gnu-emacs@gnu.org; Sun, 10 Oct 2021 13:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mZcRa-0001Ol-Ct for bug-gnu-emacs@gnu.org; Sun, 10 Oct 2021 13:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Oct 2021 17:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51007 X-GNU-PR-Package: emacs Original-Received: via spool by 51007-submit@debbugs.gnu.org id=B51007.16338862135356 (code B ref 51007); Sun, 10 Oct 2021 17:17:02 +0000 Original-Received: (at 51007) by debbugs.gnu.org; 10 Oct 2021 17:16:53 +0000 Original-Received: from localhost ([127.0.0.1]:55730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZcRQ-0001OK-Lh for submit@debbugs.gnu.org; Sun, 10 Oct 2021 13:16:53 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:46179) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZcRL-0001O1-0k for 51007@debbugs.gnu.org; Sun, 10 Oct 2021 13:16:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1633886200; bh=/nI/V+gFuyFri8qllMMffubry31bpKHeNMrkodlAVms=; h=X-UI-Sender-Class:Subject:To:References:Cc:From:Date:In-Reply-To; b=JYQ+O1D+mK8a+QLHcbgK+K4XFjSNSIYY3iN0fNMEc8n4jVyS+0oCD6OPitSwBAx4w RPXzflWg63QdXMkU7Ax/sp6pxqN59G0w1Qge7DpO4GfY1iHZcNdoR2uDQp128iZk1S iXxV4w0GWom6ixU3ao89J9KKsmchMudV0cEa0SE4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.102] ([212.95.5.1]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHoN2-1mVmPO0InG-00EtBF; Sun, 10 Oct 2021 19:16:40 +0200 In-Reply-To: <6D2FC628-BF92-4C35-8552-FBBEF0C7FDDC@taranawireless.com> Content-Language: en-US X-Provags-ID: V03:K1:ZMMjUnV0s/kuazawt9VcXZKygZQRn7ybfaWNNft8HjhjlYgY3sL REtv1QidNKuZ0+0PhQSXmu/i1fCQ0s1oVX/j+T/291kNYpCRo+L0pFn13iQvBPpF1jHTqiZ UyqdRRzQdlzylyU1gaZlvopT18k4AzqpyQlI+CzbkEUs+a+p4NNgDEJYu6nRMV8eM5BIL2+ bBXdLP76z8bCa7ldKpT+Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:+ZTvjQlk8Eo=:jez0G7FpXb8JoTiMKxXxvX xhVqqQB6wkCXSDVP5sO2BmlUZtJcl4sm4kr5innT+bAOEWzsNjLflEmeVWcsOr5vmR0zK3edm ABP6kiipaZemmWxIl6cAWE+9MJSQr6gh+2I6h/GiNV6md1PqqRzOtcRPUqiL+wJUisoco1x5J SGKkw1DvCbJiM9YUsYZEgWWJMzW3lLqH1uDqNVI9ihrYeIZr4vl/7A0rTmuTxrlowyH5DNVq2 iHF15l9J882QZ3rRoWzy6EL0e4S9Njbs8EwbvjPouNxN4Z2TRZ2/pHUTUw4J5PBa9rht2Seed Jl8qXxtz4fbkCSSXd7KP51wb+MaCyNpc2GohU5oyUxVwdkv6qRr2fEhMs8eiPNBnWHpyzBnmo z+rKBMhqi/JinkZDoMYYbm/7QtD7DirNb+T61uJ6gMkVlflx5qzf1bZ2OdC0fVvj+YJicp1rB FFPQJFjZ5SYwkNkZl8cnsOBrFoRa3Sak9Hvy4EkuwfZtqNKqLO7VMCHkLmQFCBKi9RU/ZPUtD OJzfFSO/soC6UD7ZVr8Ysu6DSExc5XJgwwRyfbSRVs5D8IZdfFCOZtmyXVty+fu51f6T2cvDq J25qpTHEakp4eRfvfjqgI6SieeeIdPNvsh8FoX13wJ2ljDem0nlR3M3K3lRCIB+9RiWfE//MG JvPutcnfP7cibAGy3w1x/dOxPHYeKlrpd+HzuYuoQYH4PDXdv9aXJDp83R6YL/AJdn1pQOnWO 33vnC+4HXwyKsslb+nNRvB92TYnrXY6jL3s2kAgHZB3sKN0WTQ9REDudqg/wk7YUuQNeKurU 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:216813 Archived-At: This is a multi-part message in MIME format. --------------FE9F550DBBF92DCA7569FDED Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Indrajeet I think I have fixed this here. Basically, the bug totally breaks the behavior with -nw but only partially breaks the gui behavior. In the latter case, parts of the window structure are corrupted but apparently these do not substantially inhibit working with Emacs here. It's not excluded though, that the NS port fails in the gui case as well. I attach two fixes for this: - window.c.diff is the one I intend to install on Emacs 28 soon. - window-27.diff is one you can install for Emacs 27 provided you are able to build Emacs on your system. It includes the window.el patch which is already on Emacs 28. If you can't build Emacs yourself, I'm afraid you have to wait for the new release. Good luck and many thanks for the forensics, martin --------------FE9F550DBBF92DCA7569FDED Content-Type: text/x-patch; name="window.c.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="window.c.diff" diff --git a/src/window.c b/src/window.c index a6e8ee0d53..150c717ce8 100644 =2D-- a/src/window.c +++ b/src/window.c @@ -3194,8 +3194,10 @@ DEFUN ("delete-other-windows-internal", Fdelete_oth= er_windows_internal, window-start value is reasonable when this function is called. */) (Lisp_Object window, Lisp_Object root) { - struct window *w, *r, *s; - struct frame *f; + struct window *w =3D decode_valid_window (window); + struct window *r, *s; + Lisp_Object frame =3D w->frame; + struct frame *f =3D XFRAME (frame); Lisp_Object sibling, pwindow, delta; Lisp_Object swindow UNINIT; ptrdiff_t startpos UNINIT, startbyte UNINIT; @@ -3203,9 +3205,7 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, int new_top; bool resize_failed =3D false; - w =3D decode_valid_window (window); XSETWINDOW (window, w); - f =3D XFRAME (w->frame); if (NILP (root)) /* ROOT is the frame's root window. */ @@ -3245,7 +3245,7 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, /* Make sure WINDOW is the frame's selected window. */ if (!EQ (window, FRAME_SELECTED_WINDOW (f))) { - if (EQ (selected_frame, w->frame)) + if (EQ (selected_frame, frame)) Fselect_window (window, Qnil); else /* Do not clear f->select_mini_window_flag here. If the @@ -3278,7 +3278,7 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, if (!EQ (swindow, FRAME_SELECTED_WINDOW (f))) { - if (EQ (selected_frame, w->frame)) + if (EQ (selected_frame, frame)) Fselect_window (swindow, Qnil); else fset_selected_window (f, swindow); @@ -3313,18 +3313,12 @@ DEFUN ("delete-other-windows-internal", Fdelete_ot= her_windows_internal, w->top_line =3D r->top_line; resize_root_window (window, delta, Qnil, Qnil, Qt); if (window_resize_check (w, false)) - { - window_resize_apply (w, false); - window_pixel_to_total (w->frame, Qnil); - } + window_resize_apply (w, false); else { resize_root_window (window, delta, Qnil, Qt, Qt); if (window_resize_check (w, false)) - { - window_resize_apply (w, false); - window_pixel_to_total (w->frame, Qnil); - } + window_resize_apply (w, false); else resize_failed =3D true; } @@ -3337,18 +3331,12 @@ DEFUN ("delete-other-windows-internal", Fdelete_ot= her_windows_internal, XSETINT (delta, r->pixel_width - w->pixel_width); resize_root_window (window, delta, Qt, Qnil, Qt); if (window_resize_check (w, true)) - { - window_resize_apply (w, true); - window_pixel_to_total (w->frame, Qt); - } + window_resize_apply (w, true); else { resize_root_window (window, delta, Qt, Qt, Qt); if (window_resize_check (w, true)) - { - window_resize_apply (w, true); - window_pixel_to_total (w->frame, Qt); - } + window_resize_apply (w, true); else resize_failed =3D true; } @@ -3390,6 +3378,12 @@ DEFUN ("delete-other-windows-internal", Fdelete_oth= er_windows_internal, } replace_window (root, window, true); + /* Assign new total sizes to all windows on FRAME. We can't do that + _before_ WINDOW replaces ROOT since 'window--pixel-to-total' works + on the whole frame and thus would work on the frame's old window + configuration (Bug#51007). */ + window_pixel_to_total (frame, Qnil); + window_pixel_to_total (frame, Qt); /* This must become SWINDOW anyway ....... */ if (BUFFERP (w->contents) && !resize_failed) --------------FE9F550DBBF92DCA7569FDED Content-Type: text/x-patch; name="window-27.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="window-27.diff" diff --git a/lisp/window.el b/lisp/window.el index 95db01bca4..b844e8d17a 100644 =2D-- a/lisp/window.el +++ b/lisp/window.el @@ -1192,7 +1192,8 @@ window-toggle-side-windows ((setq state (frame-parameter frame 'window-state)) ;; A window state was saved for FRAME. Restore it and put the ;; current root window into its main window. - (let ((main-state (window-state-get (frame-root-window frame)))) + (let ((window-combination-resize t) + (main-state (window-state-get (frame-root-window frame)))) (window-state-put state (frame-root-window frame) t) (window-state-put main-state (window-main-window frame))) (window--sides-reverse-frame frame)) diff --git a/src/window.c b/src/window.c index f231187f7b..71c0d91ab2 100644 =2D-- a/src/window.c +++ b/src/window.c @@ -3296,7 +3296,7 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, if (window_resize_check (w, false)) { window_resize_apply (w, false); - window_pixel_to_total (w->frame, Qnil); +/** window_pixel_to_total (w->frame, Qnil); **/ } else { @@ -3304,7 +3304,7 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, if (window_resize_check (w, false)) { window_resize_apply (w, false); - window_pixel_to_total (w->frame, Qnil); +/** window_pixel_to_total (w->frame, Qnil); **/ } else resize_failed =3D true; @@ -3320,7 +3320,7 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, if (window_resize_check (w, true)) { window_resize_apply (w, true); - window_pixel_to_total (w->frame, Qt); +/** window_pixel_to_total (w->frame, Qt); **/ } else { @@ -3328,7 +3328,7 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, if (window_resize_check (w, true)) { window_resize_apply (w, true); - window_pixel_to_total (w->frame, Qt); +/** window_pixel_to_total (w->frame, Qt); **/ } else resize_failed =3D true; @@ -3371,6 +3371,8 @@ DEFUN ("delete-other-windows-internal", Fdelete_othe= r_windows_internal, } replace_window (root, window, true); + window_pixel_to_total (w->frame, Qnil); + window_pixel_to_total (w->frame, Qt); /* This must become SWINDOW anyway ....... */ if (BUFFERP (w->contents) && !resize_failed) --------------FE9F550DBBF92DCA7569FDED--