From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Trust me I am a Doctor Newsgroups: gmane.emacs.bugs Subject: bug#49275: 28.0.50; [PATCH] improve-switch-to-prev-buffer-skip Date: Thu, 08 Jul 2021 14:43:46 +0200 Message-ID: <87sg0p55z1.fsf@riseup.net> References: <87lf6sy76c.fsf@riseup.net> <14ae1372-39c7-c4b0-be94-6944df2724d4@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21367"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49275@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 08 14:47:09 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1TQr-0005NJ-DJ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Jul 2021 14:47:09 +0200 Original-Received: from localhost ([::1]:40342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1TQq-0004gv-CE for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Jul 2021 08:47:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1TQk-0004fz-D3 for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2021 08:47:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1TQk-00048s-21 for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2021 08:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m1TQj-0007bo-Vw for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2021 08:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Trust me I am a Doctor Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Jul 2021 12:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49275 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 49275-submit@debbugs.gnu.org id=B49275.162574837026572 (code B ref 49275); Thu, 08 Jul 2021 12:47:01 +0000 Original-Received: (at 49275) by debbugs.gnu.org; 8 Jul 2021 12:46:10 +0000 Original-Received: from localhost ([127.0.0.1]:54605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1TPt-0006uA-Kd for submit@debbugs.gnu.org; Thu, 08 Jul 2021 08:46:10 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:51214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1TPq-0006m7-Pu for 49275@debbugs.gnu.org; Thu, 08 Jul 2021 08:46:08 -0400 Original-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 Original-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) In-reply-to: <14ae1372-39c7-c4b0-be94-6944df2724d4@gmx.at> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209671 Archived-At: --=-=-= Content-Type: text/plain martin rudalics 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 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 -- --=-=-=--