GNU bug report logs - #73545
30.0.91; Strange behaviour on switch-to-next-buffer

Previous Next

Package: emacs;

Reported by: Rahul Martim Juliato <rahuljuliato <at> gmail.com>

Date: Sun, 29 Sep 2024 04:27:02 UTC

Severity: normal

Found in version 30.0.91

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Rahul Martim Juliato <rahuljuliato <at> gmail.com>
Subject: bug#73545: closed (Re: bug#73545: 30.0.91; Strange behaviour on
 switch-to-next-buffer)
Date: Sat, 05 Oct 2024 10:33:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#73545: 30.0.91; Strange behaviour on switch-to-next-buffer

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 73545 <at> debbugs.gnu.org.

-- 
73545: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73545
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 73545-done <at> debbugs.gnu.org, rahuljuliato <at> gmail.com
Subject: Re: bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer
Date: Sat, 05 Oct 2024 13:31:48 +0300
> Date: Sun, 29 Sep 2024 17:49:35 +0200
> From: martin rudalics <rudalics <at> gmx.at>
> Cc: 73545 <at> debbugs.gnu.org
> 
>  > What
>  > is the value of that variable?
> 
> Found as:
> 
> (setq switch-to-prev-buffer-skip-regexp "\\*[^*]+\\*")
> 
> And the explanation is this snippet from 'switch-to-prev-buffer':
> 
>        (when (and skipped (not (functionp switch-to-prev-buffer-skip)))
>          ;; Show first skipped buffer, unless skip was a function.
> 	(setq new-buffer skipped)
> 	(set-window-buffer-start-and-point window new-buffer)))
> 
> That is, if the regexp excludes a specific buffer but
> 'switch-to-prev-buffer' didn't find another suitable buffer, it switches
> to the first excluded buffer.  The Elisp manual is clear about this:
> 
>       This user option should be either a regular expression or a list of
>       regular expressions.  Buffers whose names match one of those
>       regular expressions will be ignored by ‘switch-to-prev-buffer’ and
>       ‘switch-to-next-buffer’ (except when there’s no other buffer to
>       switch to).

Thanks, I've now added this caveat to the variable's doc string, and
I'm therefore closing this bug.

[Message part 3 (message/rfc822, inline)]
From: Rahul Martim Juliato <rahuljuliato <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.91; Strange behaviour on switch-to-next-buffer
Date: Sun, 29 Sep 2024 01:25:21 -0300
[Message part 4 (text/plain, inline)]
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
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 226 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.