From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Re: master 27381d71c65: Improve window/buffer handling code Date: Thu, 01 Aug 2024 05:02:31 -0400 Message-ID: References: <172249798663.17732.2340940564858834576@vcs2.savannah.gnu.org> <20240801073947.3C06FC1CAE5@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25596"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Martin Rudalics To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 01 11:03:49 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sZRiv-0006Sx-56 for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Aug 2024 11:03:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZRi9-00074O-9j; Thu, 01 Aug 2024 05:03:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZRhf-0006kY-Sq for emacs-devel@gnu.org; Thu, 01 Aug 2024 05:02:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZRhf-0003rf-As; Thu, 01 Aug 2024 05:02:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=daVCFj80aLEOejYtSYvHNehcMJG3M2PqDeMJNJ2gkR4=; b=LEQMvHGSaMfgINT11Mlu pJDotf4y3p2nUA/JN2lJhq1NsOKQEFvv1wN9EehDdnEW7uSvvDiZls19RautuLMHruJLkH3+XBM+3 GdMZo9Hx0813HtRCzE+sWSW+5HXGGubD8ikYiehTu1x7gIo0558HFtyOR6sTAHGwNQ2q81GavGHTG Iggby7WHmE0VxOjRpi2cDAD7+vKNxaGnMfgcnMzNXA0wyaGKB1q1EJtBzv96kvCgeHVPQelTSCyWP 5GatdRmM4EiqFBOcTXLe4PoHmNg/TLYhucpAV3u36mS2KWFU3WarykRPQXi6O0YRYZoThlWqcwU4W fuuhoHB/6rYCog==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1sZRhf-0001C4-4Q; Thu, 01 Aug 2024 05:02:31 -0400 In-Reply-To: <20240801073947.3C06FC1CAE5@vcs2.savannah.gnu.org> (Martin Rudalics via Mailing list for Emacs changes's message of "Thu, 1 Aug 2024 03:39:46 -0400 (EDT)") X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322258 Archived-At: Martin Rudalics via Mailing list for Emacs changes writes: > branch: master > commit 27381d71c65bd0ba93ed61f57011dbc66bd5bfab > Author: Martin Rudalics > Commit: Martin Rudalics > > Improve window/buffer handling code > > The purpose of these changes is to improve the code handling the > display of buffers in windows, switching to previous and next > buffers in windows and restoring a previous state after quitting > or killing buffers. In particular it does: > > - Add a new window parameter 'quit-restore-prev' so a window can > keep its initial 'quit-restore' parameter and undoing a sequence > of quit window operations becomes more reliable (Bug#59862). > > - Optionally have 'kill-buffer' call 'quit-restore-window' for > all windows showing the argument buffer (Bug#59862). > > - Add a new hook so it's possible to avoid that a window gets > deleted implicitly by functions like 'kill-buffer' (Bug#71386). > > - Add a new option to make 'quit-restore-window' delete windows > more aggressively (Bug#59862). > > - Immediately remove killed buffers from all windows' previous > and next buffers. For windows that are already dead, use a weak > hash table to be used by 'kill-buffer'. This avoids any special > handling of such windows by the garbage collector. > > - Immediately remove 'quit-restore' and 'quit-restore-prev' > window parameters that reference killed buffers. These > parameters have no more use once their buffers got killed. > > - Make sure that internal windows do not have any previous and > next buffers. This fixes a silly memory leak. > > - Make sure that after set_window_buffer and some wset_buffer > calls the buffer now shown in the window does not appear in the > lists of that window's previous and next buffers. The old > behavior could make functions investigating these lists > erroneously believe that there still existed some other buffer > to switch to. > > * src/alloc.c (mark_discard_killed_buffers): Remove function. > (mark_window): No more filter previous and next buffer lists. > * src/window.h (struct window): Move up prev_buffers and > next-buffers in structure; they are now treated by the collector > as usual. > * src/window.c (window_discard_buffer_from_alist) > (window_discard_buffer_from_list) > (window_discard_buffer_from_window) > (window_discard_buffer_from_dead_windows) > (Fwindow_discard_buffer): New functions. > (set_window_buffer): Discard BUFFER from WINDOW's previous and > next buffers. > (make_parent_window): Make sure internal windows have no previous > and next buffers. > (make_window): Don't initialize window's previous and next > buffers, they are handled by allocate_window now. > (Fdelete_window_internal): Add WINDOW to window_dead_windows_table. > (Fset_window_configuration): Remove resurrected window from > window_dead_windows_table. Make sure buffers set by wset_buffer > calls are not recorded in window's previous and next buffers. > (delete_all_child_windows): Add deleted windows to > window_dead_windows_table. > (window_dead_windows_table): New weak hash table to record dead > windows that are stored in saved window configurations. > * src/buffer.c (Fkill_buffer): Call new function > 'window_discard_buffer_from_dead_windows'. > * lisp/window.el (window-deletable-functions): New hook. > (window-deletable-p): Update doc-string. Run > 'window-deletable-functions' (Bug#71386). > (unrecord-window-buffer): New argument ALL. Move body to > 'window-discard-buffer-from-window' so that if ALL is non-nil, > WINDOW's 'quit-restore' and 'quit-restore-prev' parameters get > removed too. > (switch-to-prev-buffer): Don't care about killed buffers here; > 'replace-buffer-in-windows' should have done that already. Use > 'unrecord-window-buffer'. > (switch-to-next-buffer): Don't care about killed buffers here; > 'replace-buffer-in-windows' should do that now. > (kill-buffer-quit-windows): New option. > (delete-windows-on): Update doc-string. Handle new option > 'kill-buffer-quit-windows'. Update 'unrecord-window-buffer' > calls. > (replace-buffer-in-windows): Update doc-string. Handle new > option 'kill-buffer-quit-windows' (Bug#59862). Update call to > 'unrecord-window-buffer'. > (quit-restore-window-no-switch): New option. > (quit-restore-window): Update doc-string. Handle additional > values of BURY-OR-KILL so to not kill a buffer about to be > killed by the caller. Handle 'quit-restore-prev' parameter > (Bug#59862). Handle new option 'quit-restore-window-no-switch' > (Bug#59862). > (quit-windows-on): Update doc-string. Call 'quit-window-hook' > and call 'quit-restore-window' directly so that the buffer does > not get buried or killed by the latter. Update > 'unrecord-window-buffer' call. > (display-buffer-record-window): Update doc-string. Handle new > `quit-restore-prev' parameter (Bug#59862). > (switch-to-buffer): Call 'display-buffer-record-window' so a > latter 'quit-restore-window' can use its parameters. > * doc/lispref/windows.texi (Deleting Windows): Describe implicit > deletion of windows and new hook 'window-deletable-functions'. > (Buffers and Windows): Update description of > 'replace-buffer-in-windows'. Describe new option > 'kill-buffer-quit-windows'. > (Quitting Windows): Describe 'quit-restore-prev' parameter and > new option 'quit-restore-window-no-switch'. Update description > of 'quit-restore-window'. > (Window Parameters): Mention 'quit-restore-prev' parameter. > * etc/NEWS: Add entries for 'window-deletable-functions', > 'kill-buffer-quit-windows', 'quit-restore-window-no-switch'. > mention new parameter 'quit-restore-prev' and new argument > values for 'quit-restore-window'. Hi Martin, I think this change is regressing on master: todo-test-todo-quit02 (0.026575 sec) at lisp/calendar/todo-mode-tests.el:110 would you mind having a look? Thanks Andrea