GNU bug report logs - #78785
29.3; docs: switch-to-prev-buffer-skip is hard to find

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Chris Hibbert <hibbert@HIDDEN>; dated Fri, 13 Jun 2025 15:14:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 78785 <at> debbugs.gnu.org:


Received: (at 78785) by debbugs.gnu.org; 16 Jun 2025 09:52:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 16 05:52:55 2025
Received: from localhost ([127.0.0.1]:42463 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uR6WM-0000OE-Pb
	for submit <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:52:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42788)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uR6WJ-0000NJ-H6
 for 78785 <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:52:52 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uR6W7-0002Rq-BK; Mon, 16 Jun 2025 05:52:40 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=5nFhbAgcdY1afS945vsHHl8qpQz/YSdeW4WGMiaF2Ls=; b=c1/pRQdWVHFFYYz4UlsN
 OnyEEZ26bziOi00aQsiCDr/Lzaorg87w2Ia2rengyfhQcjEZWe5IAUaYZRFTOdTGjz1AlTcgIjLxV
 fDzaorj4AYZcN33GUBcjWpxvz4cg/fK1dCVJ4p7oE85ZRo8mNyD+HOeAvlRG2JDU1bLtvS7fo3AKU
 EusGwFewR/ZPy5EGaWhCfsHt3sCY7OmIRMgs3lOKhNrp5mHG1f4rZxf8Q7sEVXsWhZoPDtHZ70iAF
 vGfi2sz/Mh70QbKIrPChcoAIUEJt7Jl2d1ZOJqYmVyYe0xDBrkkF+3r50c5ifREZ8BLGod2B6YbTj
 nSaD2kNUeGcQdQ==;
Date: Mon, 16 Jun 2025 12:52:00 +0300
Message-Id: <861prkovy7.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Chris Hibbert <hibbert@HIDDEN>, martin rudalics <rudalics@HIDDEN>
In-Reply-To: <a2931048-a185-4339-af21-61a402d50161@HIDDEN> (message
 from Chris Hibbert on Wed, 11 Jun 2025 16:30:04 -0700)
Subject: Re: bug#78785: 29.3; docs: switch-to-prev-buffer-skip is hard to find
References: <a2931048-a185-4339-af21-61a402d50161@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78785
Cc: 78785 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 11 Jun 2025 16:30:04 -0700
> From: Chris Hibbert <hibbert@HIDDEN>
> 
> I reported that "kill-buffer chooses a visible buffer as replacement" on
> the Emacs StackEchange.
> (https://emacs.stackexchange.com/questions/84630)
> 
> Someone responded, and once he understood my problem, pointed out that 
> switch-to-prev-buffer-skip provides the control I want.
> 
> I'm now suggesting that it would be helpful to document this better.

I think there's some confusion here, see below.

> For instance, the docs for kill-buffer
> (https://www.gnu.org/software/emacs/manual/html_node/emacs/Kill-Buffer.html),
> say that
>     "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."
> 
> That describes the behavior I want, but not the default, AFAICT.
> 
> I think the default value of switch-to-prev-buffer-skip is nil. The docs
> for switch-to-prev-buffer-skip say
>    If this variable is nil, ‘switch-to-prev-buffer’ may switch to
>    any buffer, including those already shown in other windows.

There are two related, but different behaviors here, which both happen
when the current buffer is killed:

  . which buffer becomes the current one, and
  . which buffer replaces the current buffer in its window

The manual's documentation of the behavior of kill-buffer which you
quote talks about the former, whereas switch-to-prev-buffer-skip
affects the latter.

So I don't see a problem in the documentation, and AFAIU the
correction you suggested for the manual is incorrect, because it
wrongly conflates these two subtly different behaviors.

I'm adding Martin to this discussion, in the hope that he will have
more comments (and will correct me if I'm wrong).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78785; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Jun 2025 15:13:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 13 11:13:45 2025
Received: from localhost ([127.0.0.1]:48161 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uQ66B-0000Gf-V7
	for submit <at> debbugs.gnu.org; Fri, 13 Jun 2025 11:13:45 -0400
Received: from lists.gnu.org ([2001:470:142::17]:57266)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2)
 (envelope-from <SRS0=Y+g5+J=Y3=mydruthers.com=hibbert@HIDDEN>)
 id 1uPVqk-0000Yl-20
 for submit <at> debbugs.gnu.org; Wed, 11 Jun 2025 20:31:22 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1)
 (envelope-from <SRS0=Y+g5+J=Y3=mydruthers.com=hibbert@HIDDEN>)
 id 1uPVqd-0007CR-Lo
 for bug-gnu-emacs@HIDDEN; Wed, 11 Jun 2025 20:31:15 -0400
Received: from bosmailout04.eigbox.net ([66.96.187.4])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1)
 (envelope-from <SRS0=Y+g5+J=Y3=mydruthers.com=hibbert@HIDDEN>)
 id 1uPVqW-0003xb-Mq
 for bug-gnu-emacs@HIDDEN; Wed, 11 Jun 2025 20:31:13 -0400
Received: from bosmailscan05.eigbox.net ([10.20.15.5])
 by bosmailout04.eigbox.net with esmtp (Exim) id 1uPUtX-0000cI-2I
 for bug-gnu-emacs@HIDDEN; Wed, 11 Jun 2025 19:30:11 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=mydruthers.com; s=dkim; h=Sender:Content-Transfer-Encoding:Content-Type:
 Subject:From:To:MIME-Version:Date:Message-ID:Reply-To:Cc:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=foYqgYp5RGbbdPyT6FxaFxC1VYfmVN8OEIpI9bH83hg=; b=rTInv9wo2kSt2j0maa3LjcrDUy
 6deZFyH5+Uyb7Ul//VRNkJwmHm9RC1l29AMZzbocMCuAST1q775vtCXX/GN9+tEyGENV9C8VGed+G
 Xf/ZBhI2h8cpJQcWkGo3w5xZDSEUgvqf2L06jsDwa60wAyFKsUYFjDTvBHOR64OF66MN779WOiuYI
 6Mx+Nru6ynk4kXTopV1f9HRXOF+bsr+63bgVuX1nUbLRcKO0YmQ5j9CXGJNbhzYE4+04/zWDVex3g
 +oqgOzmgalRmEQTlUjzDGRcQacgySI1JpMnMfZdaymwsH4o6fSTlVncRtMpUOzpO5su8bqum8FPvL
 Fi0z2ByA==;
Received: from [10.115.3.34] (helo=bosimpout04)
 by bosmailscan05.eigbox.net with esmtp (Exim) id 1uPUtW-0005Q7-My
 for bug-gnu-emacs@HIDDEN; Wed, 11 Jun 2025 19:30:10 -0400
Received: from bosauthsmtp13.yourhostingaccount.com ([10.20.18.13])
 by bosimpout04 with 
 id 0PW72F0030GvDVm01PWAYS; Wed, 11 Jun 2025 19:30:10 -0400
X-Authority-Analysis: v=2.1 cv=WdWCaiRX c=1 sm=1 tr=0
 a=UH8/iCWBfdUmbm4Ft4Vi3Q==:117 a=cpF7Eqom44z/YiAqok8hhA==:17
 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=Ye9q-bpsAAAA:8 a=mDV3o1hIAAAA:8
 a=QjQeOHPwAAAA:8 a=PCNhs7OFAAAA:8 a=oMiMm2yIgLJ-3qlKKSEA:9 a=QEXdDO2ut3YA:10
 a=lST3LNw9W4sA:10 a=cHOi9Wh7YEgA:10 a=uMKInByJaMASNJfg_52p:22
 a=ZhFCym3q5arUram2UM69:22
Received: from 162-201-68-121.lightspeed.sntcca.sbcglobal.net
 ([162.201.68.121]:57610 helo=[192.168.1.85])
 by bosauthsmtp13.eigbox.net with esmtpsa
 (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim)
 id 1uPUtT-0001Oa-Ar; Wed, 11 Jun 2025 19:30:07 -0400
Message-ID: <a2931048-a185-4339-af21-61a402d50161@HIDDEN>
Date: Wed, 11 Jun 2025 16:30:04 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: bug-gnu-emacs@HIDDEN
From: Chris Hibbert <hibbert@HIDDEN>
Subject: 29.3; docs: switch-to-prev-buffer-skip is hard to find
Organization: It's Just Me
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-EN-UserInfo: 9392f423407d376e16e13c6f9cad5711:931c98230c6409dcc37fa7e93b490c27
X-EN-AuthUser: notme@HIDDEN
X-EN-OrigIP: 162.201.68.121
X-EN-OrigHost: 162-201-68-121.lightspeed.sntcca.sbcglobal.net
Received-SPF: pass client-ip=66.96.187.4;
 envelope-from=SRS0=Y+g5+J=Y3=mydruthers.com=hibbert@HIDDEN;
 helo=bosmailout04.eigbox.net
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.097,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 13 Jun 2025 11:13:42 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

I reported that "kill-buffer chooses a visible buffer as replacement" on
the Emacs StackEchange.
(https://emacs.stackexchange.com/questions/84630)

Someone responded, and once he understood my problem, pointed out that 
switch-to-prev-buffer-skip provides the control I want.

I'm now suggesting that it would be helpful to document this better. For
instance, the docs for kill-buffer
(https://www.gnu.org/software/emacs/manual/html_node/emacs/Kill-Buffer.html),
say that
    "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."

That describes the behavior I want, but not the default, AFAICT.

I think the default value of switch-to-prev-buffer-skip is nil. The docs
for switch-to-prev-buffer-skip say
   If this variable is nil, ‘switch-to-prev-buffer’ may switch to
   any buffer, including those already shown in other windows.

If the default value of switch-to-prev-buffer-skip is changed to
'visible', the doc for kill-buffer would be correct. Alternatively, we
could replace the line I quoted from kill-buffer to say

    "If you kill the current buffer, another buffer becomes current: the
    default chooses an arbitrary buffer. To specify a different strategy,
    set the variable switch-to-prev-buffer-skip to a non-nil value.
    'visible' tells it to skip buffers that are visible.


Chris


In GNU Emacs 29.3 (build 1, aarch64-apple-darwin21.6.0, NS
  appkit-2113.60 Version 12.6.6 (Build 21G646)) of 2024-03-24 built on
  armbob.lan
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.5

Configured using:
  'configure --with-ns '--enable-locallisppath=/Library/Application
  Support/Emacs/${version}/site-lisp:/Library/Application
  Support/Emacs/site-lisp' --with-modules 'CFLAGS=-DFD_SETSIZE=10000
  -DDARWIN_UNLIMITED_SELECT' --with-x-toolkit=no'

Configured features:
ACL GLIB GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER
PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB

Important settings:
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
   global-git-commit-mode: t
   magit-auto-revert-mode: t
   shell-dirtrack-mode: t
   desktop-save-mode: t
   server-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   line-number-mode: t
   visual-line-mode: t
   indent-tabs-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   abbrev-mode: t

Load-path shadows:
/Users/chris/.emacs.d/elpa/transient-0.8.8/transient hides 
/Applications/Emacs.app/Contents/Resources/lisp/transient

Features:
(shadow sort mail-extr emacsbug completion mode-local shortdoc
magit-extras expand magit-bookmark bookmark filecache xref project
tabify cus-start flyspell apropos ispell warnings sh-script rx
executable help-fns radix-tree cl-print debug backtrace find-func rect
compare-w files-x grep compile display-line-numbers dabbrev doc-view
jka-compr image-mode exif misearch multi-isearch dired-aux vc-hg vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view vc bug-reference
magit-ediff ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help
ediff-init ediff-util face-remap lisp-mnt magit-submodule magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func magit-diff smerge-mode diff git-commit
log-edit message sendmail dired dired-loaddefs rfc822 mml mml-sec epa
derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader
pcvs-util add-log magit-core magit-autorevert magit-margin
magit-transient magit-process with-editor shell pcomplete comint
ansi-osc ring ansi-color magit-mode transient edmacro kmacro benchmark
magit-git magit-base magit-section format-spec cursor-sensor crm llama
compat compat-30 cl-extra help-mode yank-media mhtml-mode css-mode smie
eww xdg url-queue thingatpt shr pixel-fill kinsoku url-file svg xml puny
mm-url gnus nnheader gnus-util text-property-search mail-utils range
mm-util mail-prsvr color sgml-mode facemenu dom autorevert filenotify
vc-git diff-mode easy-mmode vc-dispatcher js c-ts-common treesit imenu
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs time-date desktop frameset server cus-edit pp cus-load
icons wid-edit finder-inf magit-autoloads pcase magit-section-autoloads
llama-autoloads transient-autoloads with-editor-autoloads info
compat-autoloads package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp
byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 373297 130580)
  (symbols 48 26162 0)
  (strings 32 103677 10744)
  (string-bytes 1 3319413)
  (vectors 16 63608)
  (vector-slots 8 1610226 242811)
  (floats 8 399 511)
  (intervals 56 5463 6415)
  (buffers 984 45))

-- 
Currently reading: The Coming Wave, Mustafa Suleyman; Infinity
     Hold 3, Barry B. Longyear; Cancelled: The Shape of Things to
     Come, by Danny King; The Algebraist, Iain Banks; 1638: The
     Sovereign States, Eric Flint, et. al

Chris Hibbert
hibbert@HIDDEN
Blog:   http://www.pancrit.org
http://mydruthers.com








Acknowledgement sent to Chris Hibbert <hibbert@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#78785; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 16 Jun 2025 10:00:02 UTC

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