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

From: Chris Hibbert <[email-masked]>
Date: Tue, 17 Jun 2025 15:47:02 -0700

On 6/17/25 4:02 AM, Eli Zaretskii wrote:
> 
> Meanwhile, I don't think I understand what was your practical problem
> with kill-buffer.  Can you tell what you tried to achieve and what
> information was missing in the documentation which would have helped
> you do what you wanted?  Because this discussion started without a
> clear description of the original problem (and the StackExchange
> discussion doesn't clarify that, either).
> 
> Thanks.

I'll reframe my original problem that led to the report. Meanwhile, I'll 
concede that I don't get how the two phase process that chooses a window 
and then a buffer to display (or is it vice-versa?) works, but I don't 
need to, I think.

A thing that often happens to me is that I'm working on editing several 
files in multiple windows in a single frame to get some task done. At 
some point, I decide that I'm done, and I want to sequentially kill all 
the buffers, checking that they were saved (and I wasn't in the middle 
of something in each) as I go.

Long ago, it was the case that each time I deleted one buffer, it would 
be replaced by a different relatively recently visited buffer, which I 
could take a look at, and then delete or edit, and then continue with 
clean-up. More recently, the behavior changed, so that after I had 
killed a few buffers, it would replace the killed buffer with another 
that was already visible. This meant I would kill a buffer, then ask 
emacs to give me a different recently-visited buffer, and then look at 
that one. If I have 3 or 4 windows open, when I kill the current one, 
showing in more than one window, both buffers are replaced in their 
windows by the same buffer.

Now with (setq switch-to-prev-buffer-skip 'visible), I get the behavior 
I want. When I kill a buffer, I get to see a different recent buffer. If 
I kill a buffer that is displayed in more than one window, each window 
gets is replaced by a different recently visited buffer.

I'm satisfied with this behavior, but I started this long discussion 
because I thought the manual on kill-buffer said that it did what I 
wanted in the default case. I don't think it does.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Kill-Buffer.html#:~:text=C%2Dx%20k%20(%20kill%2Dbuffer%20),displayed%20in%20any%20window%20now.

"If you kill the current buffer, another buffer becomes current: one 
that was current in the recent past but is not displayed in any window now."

Chris
-- 
Competition is virtually indistinguishable from anticompetitive
behavior. Every firm strives to undercut its rivals, to put its
rivals out of business, ... or to steal its rivals' customers.
    --- Geoffrey Manne and Justin Hurwitz, ICLE

Chris Hibbert
[email-masked]
Blog:   http://www.pancrit.org
http://mydruthers.com