Subject: 30.0.91; Strange behaviour on switch-to-next-buffer
From: Rahul Martim Juliato <[email-masked]>
To: [email-masked]
Date: Sun, 29 Sep 2024 01:25:21 -0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello there!

I just wanted to report something I found a bit strange.

I would like some keybindings to jump to the next/previous *non-special*
buffer.

With these settings:

 (setq switch-to-prev-buffer-skip-regexp "\*[^*]+\*")
 (setq switch-to-next-buffer-skip-regexp "\*[^*]+\*")

I have the init.el file open, along with the Messages and scratch
buffers.

When I run (switch-to-next-buffer) or (switch-to-previous-buffer), I get
a special buffer. If I run it again, I return to the file, and running
it once more takes me to another special buffer.

If I open another file, like .bashrc, it works as I initially expected.
Now, (switch-to-next-buffer) switches to init.el, and running it again
returns me to init.el back and forth, without switching to any more
special buffers.

It seems that I need to have at least two non-special buffers open. With
only one, the switch function probably (I haven't checked) reaches the
end of the buffer list without finding a match and returns the last
buffer.

Should it work this way? If there are no matches, shouldn't it stay on
the current buffer and/or display a message like "no next/prev buffer"
in the echo area?

Thanks!

-- 
Rahul Martim Juliato
https://www.rahuljuliato.com

PGP Fingerprint: 6B68 4353 84E2 2C7E 5A26  B79A C666 FC94 BD7E A483
PGP Public Key : https://www.rahuljuliato.com/rahul_pub_key.asc