GNU bug report logs - #49275
28.0.50; [PATCH] improve-switch-to-prev-buffer-skip

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: Trust me I am a Doctor <pillule@HIDDEN>; Keywords: patch; dated Tue, 29 Jun 2021 16:21:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 49275) by debbugs.gnu.org; 8 Jul 2021 12:46:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 08 08:46:10 2021
Received: from localhost ([127.0.0.1]:54605 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1m1TPt-0006uA-Kd
	for submit <at> debbugs.gnu.org; Thu, 08 Jul 2021 08:46:10 -0400
Received: from mx1.riseup.net ([198.252.153.129]:51214)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pillule@HIDDEN>) id 1m1TPq-0006m7-Pu
 for 49275 <at> debbugs.gnu.org; Thu, 08 Jul 2021 08:46:08 -0400
Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (Client CN "*.riseup.net",
 Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified))
 by mx1.riseup.net (Postfix) with ESMTPS id 4GLGHX6JfmzDqqQ;
 Thu,  8 Jul 2021 05:46:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak;
 t=1625748360; bh=olauWunNs8++EV2HgWpiwkI7z2E1nmHpTwPAVzyb6as=;
 h=References:From:To:Cc:Subject:Date:In-reply-to:From;
 b=mJGlm48g3ph3PkL87TUKAi+EOP3q4q0AfFFiTNSIYnGN9AN4q6wrBdqBGS63OHwCe
 YLAWHcw6icj+whiMP4Zx5IlIk9mVgQOuPg+5JireHk0nMDfPHWKDpxpUo2TIvzZJwj
 Z6vIpQQBs97Hh7x51V67XhiNITrphh3cCnBKhhcM=
X-Riseup-User-ID: A36A2B1A76E73A4578F31C80F3F370BF6CB7912C546E1F431CFB6FE82F22FB17
Received: from [127.0.0.1] (localhost [127.0.0.1])
 by fews1.riseup.net (Postfix) with ESMTPSA id 4GLGHW67crz5vND;
 Thu,  8 Jul 2021 05:45:59 -0700 (PDT)
References: <87lf6sy76c.fsf@HIDDEN>
 <14ae1372-39c7-c4b0-be94-6944df2724d4@HIDDEN>
From: Trust me I am a Doctor <pillule@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#49275: 28.0.50; [PATCH] improve-switch-to-prev-buffer-skip
Date: Thu, 08 Jul 2021 14:43:46 +0200
In-reply-to: <14ae1372-39c7-c4b0-be94-6944df2724d4@HIDDEN>
Message-ID: <87sg0p55z1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 49275
Cc: 49275 <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: -1.7 (-)

--=-=-=
Content-Type: text/plain


martin rudalics <rudalics@HIDDEN> writes:

>> Conservatively I fix that by checking if 'switch-to-prev-buffer-skip'
>> is a function.
>
> What is the intended meaning of
>
> +      (when (and skipped (not functionp switch-to-prev-buffer-skip-p))
>
> Did you mean
>
> +      (when (and skipped (not (functionp switch-to-prev-buffer-skip)))
>
> here?

Duh. Indeed.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Improve-switch-to-prev-buffer-skip.patch
Content-Description: improve switch to prev buffer skip with fixed parens

From 687725fa0ab9c5cae9a6c5efb7e24c14ce2c2a1f Mon Sep 17 00:00:00 2001
From: Trust me I am a doctor <pillule@HIDDEN>
Date: Sun, 27 Jun 2021 02:24:27 +0200
Subject: [PATCH] Improve switch-to-prev-buffer-skip

* lisp/window.el (switch-to-prev-buffer): It was fall-backing to the
first skipped buffer, what I know is it is most probably undesirable
when 'switch-to-prev-buffer-skip' is a function. So we only do it when
it is not a function.
(switch-to-next-buffer): Tiddo, and also fix a bug where this function
was returning the same buffer, as it never should do.
---
 lisp/window.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/window.el b/lisp/window.el
index c0511bec4c..668bcf0d04 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4721,8 +4721,8 @@ switch-to-prev-buffer
 	       window new-buffer (nth 1 entry) (nth 2 entry))
 	      (throw 'found t)))))
 
-      (when skipped
-        ;; Show first skipped buffer.
+      (when (and skipped (not functionp switch-to-prev-buffer-skip-p))
+        ;; Show first skipped buffer, unless skip was a function.
 	(setq new-buffer skipped)
 	(set-window-buffer-start-and-point window new-buffer)))
 
@@ -4831,6 +4831,7 @@ switch-to-next-buffer
       ;; nreverse here!)
       (dolist (entry (reverse (window-prev-buffers window)))
 	(when (and (not (eq new-buffer (car entry)))
+                   (not (eq old-buffer (car entry)))
                    (setq new-buffer (car entry))
 		   (or (buffer-live-p new-buffer)
 		       (not (setq killed-buffers
@@ -4842,8 +4843,8 @@ switch-to-next-buffer
 	     window new-buffer (nth 1 entry) (nth 2 entry))
 	    (throw 'found t))))
 
-      (when skipped
-        ;; Show first skipped buffer.
+      (when (and skipped (not functionp switch-to-prev-buffer-skip-p))
+        ;; Show first skipped buffer, unless skip was a function.
 	(setq new-buffer skipped)
 	(set-window-buffer-start-and-point window new-buffer)))
 
-- 
2.20.1


--=-=-=
Content-Type: text/plain


--

--=-=-=--




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

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


Received: (at 49275) by debbugs.gnu.org; 30 Jun 2021 07:37:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 30 03:37:13 2021
Received: from localhost ([127.0.0.1]:56359 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lyUmX-00057u-Ap
	for submit <at> debbugs.gnu.org; Wed, 30 Jun 2021 03:37:13 -0400
Received: from mout.gmx.net ([212.227.17.20]:37601)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1lyUmV-00057h-Oz
 for 49275 <at> debbugs.gnu.org; Wed, 30 Jun 2021 03:37:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1625038621;
 bh=YG9tL6Bdma2v4dq1UrDlSrANch8XOPU6uotUhJ+Q0sc=;
 h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To;
 b=ikg/ZHR7tf6F4OIyLDI7FRv9NMnlx0nxZe9bUcQngOyn0C7l3eFJKX8Bn8+qTBexk
 mX6nmkmIARZR/acS03aiTCz2XE7yqyoM3YHRcM+pRMFxwyMZtq3qm/DiVJsGLmlqhN
 +wAIN3uzVuzq5K5qVH4u6SHSkS6XwjvkvFfvgw68=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.102] ([46.125.249.76]) by mail.gmx.net (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MYvY8-1llNmP3GDY-00UqWr; Wed, 30
 Jun 2021 09:37:01 +0200
Subject: Re: bug#49275: 28.0.50; [PATCH] improve-switch-to-prev-buffer-skip
To: Trust me I am a Doctor <pillule@HIDDEN>, 49275 <at> debbugs.gnu.org
References: <87lf6sy76c.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <14ae1372-39c7-c4b0-be94-6944df2724d4@HIDDEN>
Date: Wed, 30 Jun 2021 09:37:00 +0200
MIME-Version: 1.0
In-Reply-To: <87lf6sy76c.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:h3CLJDO9/d/b+rQ1jutUgtlGNbRxcRrdUkQTMGuFdUA7O47Dx1g
 dz/a+Ci+YSI2crgbjhF3Tmwf80hJdvoQbQ1nW0h0IqdrPwZs9wm7MS+fNfYlZcU95LZfZJ+
 GdSQILofFBlwjKGfqYCI/KCvMgbAM3BuEYCInlvAIanS83TgA3vIWVdym+c4uhDsnVmXE6q
 4fzWe/gTYEqKeKdNC2ahA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:JsMSN447p2E=:2Dj5f9sxt21GIGM0T5RAEa
 TKvlLzhgfF/KUhC589lDdHpc0s7JEM+BkaVW1ITOgD0vAHeizAn7BOXGoLHg52tbxMz67W7qn
 CDxzyHwgATOiNYVgX62o58U1r8I6QF/aXOD4zKGLz8Njj5OyxO5yFJJXWaMCzm1yYCwx9C0Se
 JzG+DAkGg1f09oiBgHwAZNI+tqAub4wJrcAJSkCDGKpgC4CiqS3ytmSJaWiyzzq3QQoKexsJr
 kGPl9vi8rDEMivoF6Z+JIV/GDni7GkvteatfrQURw2ZvFfAnOeWazi89ZS84kyxh9FA7+SZ8A
 m6hVzfHKyxlmlGU79bZksOnZz2s08Fkl7Kjj+QMfyqG9uqDjT99+WImCJUIJSsw+aYwzIXKG4
 /mKKLqmut8xYkb8IaURQ6i+iy4WBRbCo61mmc0D2z900Ft9weZ44gMNsfdZjgO5SjDHRstNeH
 f08Gqr5iFOG3iwwmFdzwmpz9pVbporzx4rH0NTiRI+ObkLDdCkmSBXL9Vp76gKEBsFnOrthkP
 82Jpgskr9AJH8TJb//S5kEILJT+mqyucWojsNZSlmrNuQXZjxXM1sSR+4W2FPclX3kL2VwKPu
 mq//rXCRusIImUQ2qa4z4wfcXpIiy/HPRg1202XSu2/2xyNCLJ7nwZAFPuPQNY3ATSSstwOE1
 2QwM/18lzEveF8LfseD4lb4ToZjDEWmIle+3Gvg1t9Zt7amTgd3ANCqGeED6JA7ltw7Fx3W6k
 fzb/PqcmEIv5KUk1mCkf83X3EYTJwX/djK6eBsgDPAfprMraaEyUwf0nNfVbBpdaD8TYt0xPZ
 xt5xWTAlnJflp6seLW/3kbocYVLwvF59ag4fgehrn4GvyqGH5+RyU4F6mJeKXrmcpI8JgihAX
 zro6Kzn+u2KuM+YZPIyaOqiB3sfcijIJRONEPFOQNkCyn37NIycbiMd3OLw2HI3v2g2scKeW8
 JFfBUphGnJPb652ktVIZAzAppKnVwBMlI2mrWCf9hr4uqWHyfPZVjA8iyyYPVf0l7GLQz9kh/
 qj8xShbt8Qof+inx/k3pvZgHNL5MsYqGY9SopNwd6edX6Kt222D1LQqAuaY3ho3dLAD5X6dEN
 RppABhKGbuQneai7wKpa0J/u4krXBMQUbCU
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49275
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 (-)

 > Conservatively I fix that by checking if 'switch-to-prev-buffer-skip'
 > is a function.

What is the intended meaning of

+      (when (and skipped (not functionp switch-to-prev-buffer-skip-p))

Did you mean

+      (when (and skipped (not (functionp switch-to-prev-buffer-skip)))

here?

martin




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

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


Received: (at submit) by debbugs.gnu.org; 29 Jun 2021 16:20:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 29 12:20:19 2021
Received: from localhost ([127.0.0.1]:55172 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lyGTC-0001Nc-NV
	for submit <at> debbugs.gnu.org; Tue, 29 Jun 2021 12:20:19 -0400
Received: from lists.gnu.org ([209.51.188.17]:48536)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pillule@HIDDEN>) id 1lyGTA-0001NU-SO
 for submit <at> debbugs.gnu.org; Tue, 29 Jun 2021 12:20:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42198)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pillule@HIDDEN>)
 id 1lyGTA-0000YD-Lv
 for bug-gnu-emacs@HIDDEN; Tue, 29 Jun 2021 12:20:16 -0400
Received: from mx1.riseup.net ([198.252.153.129]:33032)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pillule@HIDDEN>)
 id 1lyGT4-0006uM-Vi
 for bug-gnu-emacs@HIDDEN; Tue, 29 Jun 2021 12:20:16 -0400
Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (Client CN "*.riseup.net",
 Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified))
 by mx1.riseup.net (Postfix) with ESMTPS id 4GDqSm1VHrzDqr0
 for <bug-gnu-emacs@HIDDEN>; Tue, 29 Jun 2021 09:20:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak;
 t=1624983608; bh=4o8arc121vx/G4xfrNAZAa3SYvLft+447CPIcQmq7k0=;
 h=From:To:Subject:Date:From;
 b=MFzr2LXm4FzLVFQArb7mGp9r5dOSY+Aav6qj/i1jupK5PGDiyRA3z14vtjY/HDxJe
 SjvqXPwkbjUZTk7DTDzBHU1ileVXANrbtK+3e5GJbLSkgnO6rdWTOV9JgEThyHkygi
 Bak0x2SivNNChXKQf/9bTBZOk3eFzx4hiQ6yM6Fs=
X-Riseup-User-ID: F0A74C3DC130224F6856F8F0F3A757E1B3FB4E0DFE5DE686B035017A27605224
Received: from [127.0.0.1] (localhost [127.0.0.1])
 by fews1.riseup.net (Postfix) with ESMTPSA id 4GDqSk3BWVz5vbQ
 for <bug-gnu-emacs@HIDDEN>; Tue, 29 Jun 2021 09:20:05 -0700 (PDT)
From: Trust me I am a Doctor <pillule@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50; [PATCH] improve-switch-to-prev-buffer-skip
Date: Tue, 29 Jun 2021 17:56:18 +0200
Message-ID: <87lf6sy76c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=198.252.153.129; envelope-from=pillule@HIDDEN;
 helo=mx1.riseup.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
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: -2.4 (--)

--=-=-=
Content-Type: text/plain


$ emacs -Q

;; Considering the next commands :

(defun pils/cycle-buffer-of-major-mode (&optional arg)
  "Switch to previous buffer of this major mode.
With ARG as \\[universal-argument], switch to the next instead."
  (interactive "P")
  (let ((switch-to-prev-buffer-skip
         (lambda (window buffer _bury-or-kill)
           (not (eq (buffer-local-value 'major-mode (window-buffer window))
                    (buffer-local-value 'major-mode buffer))))))
    (if arg (switch-to-next-buffer) (switch-to-prev-buffer nil 'append)))
  (when (eq (current-buffer) (window-old-buffer))
    (user-error "No other %s buffer available." major-mode)))

(defun pils/next-buffer-of-major-mode ()
  "Switch to the next buffer of this major mode."
  (interactive)
  (pils/cycle-buffer-of-major-mode t))

;; That we could temporary bind to :

(global-set-key (kbd "M-p") #'pils/cycle-buffer-of-major-mode)
(global-set-key (kbd "M-n") #'pils/next-buffer-of-major-mode)

Now gently but firmly, play theses emacs chords.

What happened ? The first command will put you in another mode.
That is unexpected ... Worse the second one will quickly jam.

The current implementation 'switch-to-prev-buffer-skip' fallback to the
first skipped buffer if no one have satisfied its anti-predicate. That's
why you could end up in another mode despite setting
'switch-to-prev-buffer-skip' to not select others modes.

Conservatively I fix that by checking if 'switch-to-prev-buffer-skip'
is a function.

The second issue is a bug in the implementation of
'switch-to-next-buffer'. This command should never return the same
buffer, it is wrote in its docstring, and it escaped me in commit
d0c7d8bc22.

So here a little patch to fix both.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Improve-switch-to-prev-buffer-skip.patch
Content-Description: Improve-switch-to-prev-buffer-skip

From 687725fa0ab9c5cae9a6c5efb7e24c14ce2c2a1f Mon Sep 17 00:00:00 2001
From: Trust me I am a doctor <pillule@HIDDEN>
Date: Sun, 27 Jun 2021 02:24:27 +0200
Subject: [PATCH] Improve switch-to-prev-buffer-skip

* lisp/window.el (switch-to-prev-buffer): It was fall-backing to the
first skipped buffer, what I know is it is most probably undesirable
when 'switch-to-prev-buffer-skip' is a function. So we only do it when
it is not a function.
(switch-to-next-buffer): Tiddo, and also fix a bug where this function
was returning the same buffer, as it never should do.
---
 lisp/window.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/window.el b/lisp/window.el
index c0511bec4c..668bcf0d04 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4721,8 +4721,8 @@ switch-to-prev-buffer
 	       window new-buffer (nth 1 entry) (nth 2 entry))
 	      (throw 'found t)))))
 
-      (when skipped
-        ;; Show first skipped buffer.
+      (when (and skipped (not functionp switch-to-prev-buffer-skip-p))
+        ;; Show first skipped buffer, unless skip was a function.
 	(setq new-buffer skipped)
 	(set-window-buffer-start-and-point window new-buffer)))
 
@@ -4831,6 +4831,7 @@ switch-to-next-buffer
       ;; nreverse here!)
       (dolist (entry (reverse (window-prev-buffers window)))
 	(when (and (not (eq new-buffer (car entry)))
+                   (not (eq old-buffer (car entry)))
                    (setq new-buffer (car entry))
 		   (or (buffer-live-p new-buffer)
 		       (not (setq killed-buffers
@@ -4842,8 +4843,8 @@ switch-to-next-buffer
 	     window new-buffer (nth 1 entry) (nth 2 entry))
 	    (throw 'found t))))
 
-      (when skipped
-        ;; Show first skipped buffer.
+      (when (and skipped (not functionp switch-to-prev-buffer-skip-p))
+        ;; Show first skipped buffer, unless skip was a function.
 	(setq new-buffer skipped)
 	(set-window-buffer-start-and-point window new-buffer)))
 
-- 
2.20.1


--=-=-=--




Acknowledgement sent to Trust me I am a Doctor <pillule@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#49275; 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: Thu, 8 Jul 2021 12:45:02 UTC

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