unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: emacs-devel@gnu.org
Cc: Martin Rudalics <rudalics@gmx.at>
Subject: Re: master 27381d71c65: Improve window/buffer handling code
Date: Thu, 01 Aug 2024 05:02:31 -0400	[thread overview]
Message-ID: <yp1jzh0mx94.fsf@fencepost.gnu.org> (raw)
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)")

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



       reply	other threads:[~2024-08-01  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <172249798663.17732.2340940564858834576@vcs2.savannah.gnu.org>
     [not found] ` <20240801073947.3C06FC1CAE5@vcs2.savannah.gnu.org>
2024-08-01  9:02   ` Andrea Corallo [this message]
2024-08-01 16:07     ` master 27381d71c65: Improve window/buffer handling code martin rudalics
2024-08-01 16:22       ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yp1jzh0mx94.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).