From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#7231: 23.3; Don't rebuild buffer list in iswitchb-visit-buffer Date: Mon, 18 Oct 2010 10:54:40 -0400 Message-ID: References: <87r5foy90j.fsf@telefonica.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1287414764 10707 80.91.229.12 (18 Oct 2010 15:12:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Oct 2010 15:12:44 +0000 (UTC) Cc: =?UTF-8?Q?=C3=93scar?= Fuentes , 7231@debbugs.gnu.org To: Leo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 18 17:12:41 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P7rOD-00076e-FP for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Oct 2010 17:12:41 +0200 Original-Received: from localhost ([127.0.0.1]:51774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7rOC-0000Ct-OI for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Oct 2010 11:12:40 -0400 Original-Received: from [140.186.70.92] (port=46942 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7rO6-0000Cf-BU for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 11:12:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7rO5-0000ac-19 for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 11:12:34 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7rO4-0000aQ-Vn for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 11:12:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P7r3G-00074L-7f; Mon, 18 Oct 2010 10:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Oct 2010 14:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7231 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7231-submit@debbugs.gnu.org id=B7231.128741345927167 (code B ref 7231); Mon, 18 Oct 2010 14:51:02 +0000 Original-Received: (at 7231) by debbugs.gnu.org; 18 Oct 2010 14:50:59 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7r3D-000748-Jy for submit@debbugs.gnu.org; Mon, 18 Oct 2010 10:50:59 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7r3C-000743-IM for 7231@debbugs.gnu.org; Mon, 18 Oct 2010 10:50:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag4JABv9u0xMCpO7/2dsb2JhbACgMnlyvxiDBwiCOgSSGQ X-IronPort-AV: E=Sophos;i="4.57,345,1283745600"; d="scan'208";a="80010080" Original-Received: from 76-10-147-187.dsl.teksavvy.com (HELO pastel.home) ([76.10.147.187]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 18 Oct 2010 10:54:41 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 953F7A8219; Mon, 18 Oct 2010 10:54:40 -0400 (EDT) In-Reply-To: (Leo's message of "Mon, 18 Oct 2010 03:16:44 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 18 Oct 2010 10:51:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40954 Archived-At: > - ;; Else `kill-buffer' succeeds so re-make the buffer list > - ;; taking into account packages like uniquify may rename > - ;; buffers > - (iswitchb-make-buflist iswitchb-default)))))) > + ;; else buffer was killed > + (setq iswitchb-buflist > + (delq nil (mapcar (lambda (b) > + (if (bufferp b) > + (buffer-name b) > + b)) > + bufobjs)))))))) I was about to install that change when I realized that this is fundamentally not the right approach: since some of the buffers may have changed name, the new list of matching buffers may be different (some buffers that didn't match before may match now and vice-versa). So iswitchb-make-buflist is more correct. To deal with the problem of ordering, we'll need to combine the two: call iswitchb-make-buflist to get the new list of matches, and then use bufobjs to sort the new iswitchb-buflist. Something like (iswitchb-make-buflist iswitchb-default)))))) ;; Try to preserve the previous sort order. (setq iswitchb-buflist (sort iswitchb-buflist (lambda (bn1 bn2) (< (length (or (memq (get-buffer bn1) bufobjs) ;; Place new buffers at the end. bufobjs)) (length (or (memq (get-buffer bn2) bufobjs) bufobjs)))))) Stefan