unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer
@ 2024-09-29  4:25 Rahul Martim Juliato
  2024-09-29  5:39 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Rahul Martim Juliato @ 2024-09-29  4:25 UTC (permalink / raw)
  To: 73545

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer
  2024-09-29  4:25 bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer Rahul Martim Juliato
@ 2024-09-29  5:39 ` Eli Zaretskii
  2024-09-29 12:29   ` Rahul Martim Juliato
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-09-29  5:39 UTC (permalink / raw)
  To: Rahul Martim Juliato; +Cc: 73545

> From: Rahul Martim Juliato <rahuljuliato@gmail.com>
> Date: Sun, 29 Sep 2024 01:25:21 -0300
> 
> 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.

Did you forget to double the backslashes?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer
  2024-09-29  5:39 ` Eli Zaretskii
@ 2024-09-29 12:29   ` Rahul Martim Juliato
  2024-09-29 12:51     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Rahul Martim Juliato @ 2024-09-29 12:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73545

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

On Sun, Sep 29, 2024 at 08:39:03AM +0300, Eli Zaretskii wrote:
> > From: Rahul Martim Juliato <rahuljuliato@gmail.com>
> > Date: Sun, 29 Sep 2024 01:25:21 -0300
> > 
> > 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.
> 
> Did you forget to double the backslashes?

Yep, I forgot it. Strange thing is, it worked without it :/ 

Let me correct it, what I now have is:

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

And I wrongly added a switch-to-next-buffer-skip-regexp, which does not
exist, the switch-to-prev-buffer-skip-regexp variable does it for both
prev/next functions.

That said, the behaviour is the same as I first described.

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer
  2024-09-29 12:29   ` Rahul Martim Juliato
@ 2024-09-29 12:51     ` Eli Zaretskii
  2024-09-29 14:17       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-09-29 12:51 UTC (permalink / raw)
  To: Rahul Martim Juliato, martin rudalics; +Cc: 73545

> From: Rahul Martim Juliato <rahuljuliato@gmail.com>
> Date: Sun, 29 Sep 2024 09:29:56 -0300
> Cc: 73545@debbugs.gnu.org
> 
> That said, the behaviour is the same as I first described.

If you mean that Emacs switches to a buffer whose name matches
switch-to-prev-buffer-skip-regexp when there are no other buffers to
show, then this is the intended behavior, I think.  Martin, am I
right?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer
  2024-09-29 12:51     ` Eli Zaretskii
@ 2024-09-29 14:17       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-29 14:17 UTC (permalink / raw)
  To: Eli Zaretskii, Rahul Martim Juliato; +Cc: 73545

 > If you mean that Emacs switches to a buffer whose name matches
 > switch-to-prev-buffer-skip-regexp when there are no other buffers to
 > show, then this is the intended behavior, I think.  Martin, am I
 > right?

I don't know about 'switch-to-prev-buffer-skip-regexp'.  Here I have
set 'switch-to-prev-buffer-skip' to the function

(defun skip-undisplayed-buffers (_window buffer _bury-or-kill)
   "Function for `switch-to-prev-buffer-skip'.
Skip BUFFER if it has never been displayed before."
   (zerop (buffer-local-value 'buffer-display-count buffer)))

(setq switch-to-prev-buffer-skip 'skip-undisplayed-buffers)

Now with emacs -Q evaluate that in *scratch* and do C-x <left>.  Gets me
"No previous buffer" and *scratch* stays.  I think the same should
happen if 'switch-to-prev-buffer-skip-regexp' matches *Messages*.  What
is the value of that variable?

martin





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-29 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-29  4:25 bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer Rahul Martim Juliato
2024-09-29  5:39 ` Eli Zaretskii
2024-09-29 12:29   ` Rahul Martim Juliato
2024-09-29 12:51     ` Eli Zaretskii
2024-09-29 14:17       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).