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: Wed, 21 Jul 2021 11:59:52 +0200 Message-ID: <87bl6wdlzn.fsf@riseup.net> References: <87lf6sy76c.fsf@riseup.net> <14ae1372-39c7-c4b0-be94-6944df2724d4@gmx.at> <87sg0p55z1.fsf@riseup.net> 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="18711"; 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 Wed Jul 21 12:11:12 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 1m69C2-0004gn-Q3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Jul 2021 12:11:11 +0200 Original-Received: from localhost ([::1]:54548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m69C1-0000KC-Me for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Jul 2021 06:11:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m693C-0003jy-UU for bug-gnu-emacs@gnu.org; Wed, 21 Jul 2021 06:02:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m693B-0007nr-T6 for bug-gnu-emacs@gnu.org; Wed, 21 Jul 2021 06:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m693B-0000oj-RO for bug-gnu-emacs@gnu.org; Wed, 21 Jul 2021 06:02: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: Wed, 21 Jul 2021 10:02: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.16268616913099 (code B ref 49275); Wed, 21 Jul 2021 10:02:01 +0000 Original-Received: (at 49275) by debbugs.gnu.org; 21 Jul 2021 10:01:31 +0000 Original-Received: from localhost ([127.0.0.1]:36160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m692h-0000nu-6G for submit@debbugs.gnu.org; Wed, 21 Jul 2021 06:01:31 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:42392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m692e-0000ni-MP for 49275@debbugs.gnu.org; Wed, 21 Jul 2021 06:01:30 -0400 Original-Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (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 4GVB1Z6B9XzF4XL; Wed, 21 Jul 2021 03:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1626861682; bh=fjp15eZkUfSxT57dw7rDLdKvJBu9lzl/KaSl7u62FSs=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=s9egC/WOrIqCKbZzqycP784eCoV+UybizjdH02HR3DtIj5QvvCj0XWvR16F0p/8ST ocAFaJqG1E7iFqQ0HbJlI3a3Q7y/nyszmkZMMNdY8uMUq+KXgPaz5aHXJnczlbBr8F QFDB7nq5gum+mVk06MSaYS4Nmg7hz2YvrMeZBk9Y= X-Riseup-User-ID: F3F7933A717249BFC1D3D9524BD819F3D0A6C0638A14E0341FA930E6CA965FF2 Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4GVB1Y75bkz1ySb; Wed, 21 Jul 2021 03:01:21 -0700 (PDT) In-reply-to: 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:210406 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable martin rudalics writes: > Sorry but this is still not right. It now gets me > > In switch-to-prev-buffer: > ../../lisp/window.el:4724:27: Warning: =E2=80=98not=E2=80=99 called with = 2 args, but requires > 1 > ../../lisp/window.el:4724:27: Warning: reference to free variable =E2=80= =98functionp=E2=80=99 > ../../lisp/window.el:4724:27: Warning: reference to free variable > =E2=80=98switch-to-prev-buffer-skip-p=E2=80=99 > > In switch-to-next-buffer: > ../../lisp/window.el:4846:27: Warning: =E2=80=98not=E2=80=99 called with = 2 args, but requires > 1 > ../../lisp/window.el:4846:27: Warning: reference to free variable =E2=80= =98functionp=E2=80=99 > ../../lisp/window.el:4846:27: Warning: reference to free variable > =E2=80=98switch-to-prev-buffer-skip-p=E2=80=99 > > martin Sorry that was the same buggy one. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-switch-to-prev-buffer-skip-more-reliable.patch Content-Description: this one is corrected >From b1375219d247d87ac72a41fb4f1887a9a40039fc Mon Sep 17 00:00:00 2001 From: Trust me I am a doctor Date: Sun, 27 Jun 2021 02:27:48 +0200 Subject: [PATCH] Make switch-to-prev-buffer-skip more reliable * 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..9315107f1f 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))) + ;; 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))) + ;; 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 -- --=-=-=--