* Re: master 27381d71c65: Improve window/buffer handling code
[not found] ` <20240801073947.3C06FC1CAE5@vcs2.savannah.gnu.org>
@ 2024-08-01 9:02 ` Andrea Corallo
2024-08-01 16:07 ` martin rudalics
0 siblings, 1 reply; 3+ messages in thread
From: Andrea Corallo @ 2024-08-01 9:02 UTC (permalink / raw)
To: emacs-devel; +Cc: Martin Rudalics
Martin Rudalics via Mailing list for Emacs changes <emacs-diffs@gnu.org>
writes:
> branch: master
> commit 27381d71c65bd0ba93ed61f57011dbc66bd5bfab
> Author: Martin Rudalics <rudalics@gmx.at>
> Commit: Martin Rudalics <rudalics@gmx.at>
>
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-01 16:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <172249798663.17732.2340940564858834576@vcs2.savannah.gnu.org>
[not found] ` <20240801073947.3C06FC1CAE5@vcs2.savannah.gnu.org>
2024-08-01 9:02 ` master 27381d71c65: Improve window/buffer handling code Andrea Corallo
2024-08-01 16:07 ` martin rudalics
2024-08-01 16:22 ` Andrea Corallo
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).