Subject: bug#78785: 29.3; docs: switch-to-prev-buffer-skip is hard to find

From: martin rudalics <[email-masked]>
Date: Tue, 17 Jun 2025 12:58:43 +0200

> And please mention it in (elisp) `Window History'.  In Emacs
 > 30.1, that doc says nothing about the relation between option
 > `switch-to-prev-buffer-skip' and `kill-buffer'.

'kill-buffer' calls 'replace-buffer-in-windows' which is documented in
the Elisp manual as

      This function calls ‘replace-buffer-in-windows’ for cleaning up all
      windows currently displaying the buffer to be killed.

'replace-buffer-in-windows' calls 'switch-to-prev-buffer' documented as

      The replacement buffer in each window is usually chosen via
      ‘switch-to-prev-buffer’ (*note Window History::).

'switch-to-prev-buffer' consults 'switch-to-prev-buffer-skip' documented
as

      The option ‘switch-to-prev-buffer-skip’ described below can be used
      to inhibit switching to certain buffers, for example, to those
      already shown in another window.

 > That's
 > probably because there's no `kill-buffer-quit-windows' in 30.1,
 > but for 30.2+ it should be mentioned, I think.

'kill-buffer-quit-windows' will be in Emacs 31.  You will have to read
its documentation there.

 > Doesn't the nil default value of `switch-to-prev-buffer-skip'
 > also mean a change in the default behavior for `kill-buffer'?
 > If so, one can wonder why the longstanding _default_ behavior
 > was changed.  Please mention this change in NEWS.

I don't remember the sequence of events leading to the present behavior.
I'll let Eli decide if mentioning any change in NEWS is needed.

 > In addition to those two "related, but different behaviors"
 > being coupled in the way you say, there's the coupling of
 > previous-buffer behaviors _in general_ with `kill-buffer's
 > own use of such a behavior.
 >
 > In the past this coupling wasn't a problem, but now it seems
 > there can be a difference between what a user might want for
 > `kill-buffer' and what they might want for other uses of
 > previous-buffer handling - no?  How can a user tell Emacs
 > what window-handling behavior to use wrt `kill-buffer', and
 > distinguish that from the behavior wanted for other
 > previous-buffer uses?

The coupling of 'switch-to-prev-buffer', 'quit-window' and 'kill-buffer'
has indeed become tighter because users wanted that.  You will have to
consult the discussions here and on emacs-devel for further details.

martin