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#2042: Ido-mode : filtering does not keep ordering Date: Sun, 25 Sep 2011 00:20:27 +0800 Message-ID: References: <6fa54e4e0901250554q1519cba5t83df1577e2cbc132@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1316881298 14821 80.91.229.12 (24 Sep 2011 16:21:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 24 Sep 2011 16:21:38 +0000 (UTC) Cc: 2042@debbugs.gnu.org To: Antoine Levitt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 24 18:21:34 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R7Uyr-0007as-Gl for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Sep 2011 18:21:33 +0200 Original-Received: from localhost ([::1]:40809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7Uyq-0008NI-JF for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Sep 2011 12:21:32 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7Uyo-0008ND-5H for bug-gnu-emacs@gnu.org; Sat, 24 Sep 2011 12:21:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R7Uyn-0001JB-4g for bug-gnu-emacs@gnu.org; Sat, 24 Sep 2011 12:21:30 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7Uyn-0001J3-31 for bug-gnu-emacs@gnu.org; Sat, 24 Sep 2011 12:21:29 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R7UzJ-0003ef-GQ for bug-gnu-emacs@gnu.org; Sat, 24 Sep 2011 12:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Sep 2011 16:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 2042 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 2042-submit@debbugs.gnu.org id=B2042.131688130114022 (code B ref 2042); Sat, 24 Sep 2011 16:22:01 +0000 Original-Received: (at 2042) by debbugs.gnu.org; 24 Sep 2011 16:21:41 +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 1R7Uyy-0003e7-Ty for submit@debbugs.gnu.org; Sat, 24 Sep 2011 12:21:41 -0400 Original-Received: from mail-pz0-f50.google.com ([209.85.210.50]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7Uyk-0003dg-7I for 2042@debbugs.gnu.org; Sat, 24 Sep 2011 12:21:39 -0400 Original-Received: by pzk37 with SMTP id 37so10619406pzk.9 for <2042@debbugs.gnu.org>; Sat, 24 Sep 2011 09:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=pcJ4yBm7m1P3rqfYaeIM4++voDTVNVCXbkO57eslutQ=; b=Iv/yrhv6B82tOAbJXLKo3zve1BOxOxEiyhRw+rkEiSCYGBXBGgDefY1/DXEBrhPP8I JbHWrzFI4BmjMLrQjNJLiUqo26SolPTIDHgQVig2Mhfqc1VU5gMy6dUNrPcSrvUvPKsp Fm04W0UsjriXQFBGRWNE1kD648Iflf3QXliUI= Original-Received: by 10.68.27.102 with SMTP id s6mr17162787pbg.43.1316881252551; Sat, 24 Sep 2011 09:20:52 -0700 (PDT) Original-Received: from localhost ([123.114.56.193]) by mx.google.com with ESMTPS id 4sm51327283pbk.5.2011.09.24.09.20.48 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Sep 2011 09:20:51 -0700 (PDT) In-Reply-To: <6fa54e4e0901250554q1519cba5t83df1577e2cbc132@mail.gmail.com> (Antoine Levitt's message of "Sun, 25 Jan 2009 14:54:28 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (Mac OS X 10.6.8) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 24 Sep 2011 12:22:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:51784 Archived-At: On 2009-01-25 21:54 +0800, Antoine Levitt wrote: > Hi, > When buffer switching in Ido, filtering the list of available buffers does > not keep the original ordering of buffers (from most recent to oldest). > Ie if I have for instance buffers foobar and barfoo, in this order, if I > type bar, they are displayed to me as barfoo foobar. I understand this is a > reasonable behavior in a number of case, but it's annoying when using ido to > quickly toggle between working buffers, where I have old and forgotten > buffers pop up as the first option in the completion list. Would it be > possible to add a switch ? > > Antoine Levitt I occasionally try iswitch-mode and find its buffer switching much more pleasant to use than ido's. The trouble is ido tries to be smart in ordering matches. Sadly that gets in the way most of the time. I wonder if people are willing to try the following (preliminary) patch and see if they miss anything. diff --git a/lisp/ido.el b/lisp/ido.el index aa6ad4aa..e0640eba 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3735,7 +3735,7 @@ (defun ido-get-bufname (win) ;;; FIND MATCHING ITEMS -(defun ido-set-matches-1 (items &optional do-full) +(defun ido-set-matches-1 (items &optional ignore) ;; Return list of matches in items (let* ((case-fold-search ido-case-fold) (slash (and (not ido-enable-prefix) (ido-final-slash ido-text))) @@ -3743,18 +3743,11 @@ (defun ido-set-matches-1 (items &optional do-full) (rex0 (if ido-enable-regexp text (regexp-quote text))) (rexq (concat rex0 (if slash ".*/" ""))) (re (if ido-enable-prefix (concat "\\`" rexq) rexq)) - (full-re (and do-full (not ido-enable-regexp) (not (string-match "\$\\'" rex0)) - (concat "\\`" rex0 (if slash "/" "") "\\'"))) - (suffix-re (and do-full slash - (not ido-enable-regexp) (not (string-match "\$\\'" rex0)) - (concat rex0 "/\\'"))) - (prefix-re (and full-re (not ido-enable-prefix) - (concat "\\`" rexq))) (non-prefix-dot (or (not ido-enable-dot-prefix) (not ido-process-ignore-lists) ido-enable-prefix (= (length ido-text) 0))) - full-matches suffix-matches prefix-matches matches) + matches) (setq ido-incomplete-regexp nil) (condition-case error (mapc @@ -3771,12 +3764,6 @@ (defun ido-set-matches-1 (items &optional do-full) (not (string= name ido-default-item))) (string= name (buffer-name ido-entry-buffer))) (setq matches (cons item matches))) - ((and full-re (string-match full-re name)) - (setq full-matches (cons item full-matches))) - ((and suffix-re (string-match suffix-re name)) - (setq suffix-matches (cons item suffix-matches))) - ((and prefix-re (string-match prefix-re name)) - (setq prefix-matches (cons item prefix-matches))) (t (setq matches (cons item matches)))))) t) items) @@ -3786,16 +3773,6 @@ (defun ido-set-matches-1 (items &optional do-full) ;; special-case single match, and handle appropriately ;; elsewhere. matches (cdr error)))) - (when prefix-matches - (ido-trace "prefix match" prefix-matches) - ;; Bug#2042. - (setq matches (nconc prefix-matches matches))) - (when suffix-matches - (ido-trace "suffix match" (list text suffix-re suffix-matches)) - (setq matches (nconc suffix-matches matches))) - (when full-matches - (ido-trace "full match" (list text full-re full-matches)) - (setq matches (nconc full-matches matches))) (when (and (null matches) ido-enable-flex-matching (> (length ido-text) 1)