all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rahul Martim Juliato <rahuljuliato@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 73545@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
	Rahul Martim Juliato <rahuljuliato@gmail.com>
Subject: bug#73545: 30.0.91; Strange behaviour on switch-to-next-buffer
Date: Thu, 3 Oct 2024 18:19:23 -0300	[thread overview]
Message-ID: <20241003211923.yablw6b4bwdydcxk@debian> (raw)
In-Reply-To: <d5a2e607-d1c7-4f8d-b7e0-cde2c3d5009b@gmx.at>

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

On Sun, Sep 29, 2024 at 05:49:35PM +0200, martin rudalics wrote:
> > 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).
> 
> So if you want to make sure that *Messages* gets always excluded, you
> have to specify a function based on that regexp like
> 
> (defun skip-these-buffers (_window buffer _bury-or-kill)
>   "Function for `switch-to-prev-buffer-skip'."
>   (string-match "\\*[^*]+\\*" (buffer-name buffer)))
> 
> (setq switch-to-prev-buffer-skip 'skip-these-buffers)
> 
> martin

Thanks a lot for the clarification!

I just found a bit strange the default behaviour (I guess I am biased by
my use case) being this way.

The snippet you provided is exactly what I was looking for.

I think this is all for this thread :)

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

  parent reply	other threads:[~2024-10-03 21:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
     [not found]         ` <d5a2e607-d1c7-4f8d-b7e0-cde2c3d5009b@gmx.at>
2024-10-03 21:19           ` Rahul Martim Juliato [this message]
2024-10-04  8:07             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-05 10:31           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241003211923.yablw6b4bwdydcxk@debian \
    --to=rahuljuliato@gmail.com \
    --cc=73545@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.