Subject: Re: bug#75949: kill-buffer-quit-windows breaks kill-buffer-hook

From: martin rudalics <[email-masked]>
Date: Mon, 3 Feb 2025 09:33:45 +0100

>> Whatever it is, nesting 'kill-buffer-hook' as in
 >>
 >>   (add-hook 'kill-buffer-hook (lambda () (kill-buffer (get-buffer "bar")))
 >> 	    nil t)
 >>
 >> is not really recommended.
 >
 > What is a recommended way to do this?  This is a valid use case
 > when killing one buffer requires also killing a dependent buffer.

Any function on any hook that changes the corresponding infrastructure
should preserve the state around any such change.  The basic values that
should remain unchanged are the selected window, the selected window of
each frame and the current buffer (unless the function deletes them).

martin