From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs Subject: bug#7231: 23.3; Don't rebuild buffer list in iswitchb-visit-buffer Date: Wed, 20 Oct 2010 12:53:49 +0800 Message-ID: References: <87r5foy90j.fsf@telefonica.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1287551566 23052 80.91.229.12 (20 Oct 2010 05:12:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Oct 2010 05:12:46 +0000 (UTC) Cc: =?UTF-8?Q?=C3=93scar?= Fuentes , 7231@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 20 07:12:44 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 1P8Qyh-0001r9-Jz for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Oct 2010 07:12:43 +0200 Original-Received: from localhost ([127.0.0.1]:60752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8Qyg-0002l9-Os for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Oct 2010 01:12:42 -0400 Original-Received: from [140.186.70.92] (port=45740 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8Qyb-0002l4-8G for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2010 01:12:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8QyZ-0006GG-N2 for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2010 01:12:37 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8QyZ-0006GA-Jv for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2010 01:12:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P8Qdh-0008GU-PQ; Wed, 20 Oct 2010 00:51:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2010 04:51:01 +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.128755023031759 (code B ref 7231); Wed, 20 Oct 2010 04:51:01 +0000 Original-Received: (at 7231) by debbugs.gnu.org; 20 Oct 2010 04:50:30 +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 1P8QdC-0008GC-Bc for submit@debbugs.gnu.org; Wed, 20 Oct 2010 00:50:30 -0400 Original-Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P8Qd9-0008G7-22 for 7231@debbugs.gnu.org; Wed, 20 Oct 2010 00:50:28 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Original-Received: from [59.57.34.138] (port=63928 helo=Victoria.local) by ppsw-41.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1P8Qgm-0005gH-Rb (Exim 4.72) (return-path ); Wed, 20 Oct 2010 05:54:13 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 20 Oct 2010 00:51:01 -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:41003 Archived-At: Hello Stefan, On 2010-10-20 11:00 +0800, Leo wrote: > On 2010-10-18 22:54 +0800, Stefan Monnier wrote: >> 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. > > My understanding seems to be: > > iswitchb-buflist already contains all buffers needed although its order > can be modified by iswitchb-next/prev-match. That modified ordering info > is lost after iswitchb-make-buflist. There may be new matches appearing > due to buffer name changes but this is taken care of automatically by > iswitchb-exhibit. > > Leo If the proposed solution to iswitchb is acceptable, a similar one should be done for ido. Here is a patch to be applied on top of http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6943. >From 5686c7c723d9bad601d870aff54b7a3d8edce471 Mon Sep 17 00:00:00 2001 Date: Wed, 20 Oct 2010 12:17:53 +0800 Subject: [PATCH] Don't rebuild buffer list in ido-kill-buffer-at-head Rebuilding buffer list will lose the order of matches seen by the user in particular when it has been rotated. --- lisp/ido.el | 32 ++++++++++++++------------------ 1 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lisp/ido.el b/lisp/ido.el index 4a60288..d913069 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3978,26 +3978,22 @@ If cursor is not at the end of the user input, delete to end of input." (if (not (eobp)) (delete-region (point) (line-end-position)) (let ((enable-recursive-minibuffers t) - (buf (ido-name (car ido-matches))) - (nextbuf (cadr ido-matches))) + (buf (ido-name (car ido-matches)))) (cond ((get-buffer buf) - ;; If next match names a buffer use the buffer object; buffer - ;; name may be changed by packages such as uniquify. - (when (and nextbuf (get-buffer nextbuf)) - (setq nextbuf (get-buffer nextbuf))) - (if (null (kill-buffer buf)) - ;; Buffer couldn't be killed. - (setq ido-rescan t) - ;; Else `kill-buffer' succeeds so re-make the buffer list - ;; taking into account packages like uniquify may rename - ;; buffers. - (if (bufferp nextbuf) - (setq nextbuf (buffer-name nextbuf))) - (setq ido-default-item nextbuf - ido-text-init ido-text - ido-exit 'refresh) - (exit-minibuffer))) + ;; Note that some packages (eg uniquify.el) may change buffer + ;; names. So save a list of buffer objects. + (let ((bufobjs (mapcar (lambda (name) + (or (get-buffer name) name)) + ido-cur-list))) + (if (null (kill-buffer buf)) + ;; Buffer couldn't be killed. + (setq ido-rescan t) + (setq ido-cur-list + (delq nil (mapcar (lambda (b) (if (bufferp b) + (buffer-name b) + b)) + bufobjs)))))) ;; Handle virtual buffers ((assoc buf ido-virtual-buffers) (setq recentf-list -- 1.7.3