* bug#2042: Ido-mode : filtering does not keep ordering
@ 2009-01-25 13:54 Antoine Levitt
2011-09-24 16:20 ` Leo
2012-09-16 22:28 ` Leo
0 siblings, 2 replies; 12+ messages in thread
From: Antoine Levitt @ 2009-01-25 13:54 UTC (permalink / raw
To: bug-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 585 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2009-01-25 13:54 bug#2042: Ido-mode : filtering does not keep ordering Antoine Levitt
@ 2011-09-24 16:20 ` Leo
2011-09-25 8:54 ` Antoine Levitt
2011-10-01 19:10 ` Chong Yidong
2012-09-16 22:28 ` Leo
1 sibling, 2 replies; 12+ messages in thread
From: Leo @ 2011-09-24 16:20 UTC (permalink / raw
To: Antoine Levitt; +Cc: 2042
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)
^ permalink raw reply related [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2011-09-24 16:20 ` Leo
@ 2011-09-25 8:54 ` Antoine Levitt
2011-10-01 19:10 ` Chong Yidong
1 sibling, 0 replies; 12+ messages in thread
From: Antoine Levitt @ 2011-09-25 8:54 UTC (permalink / raw
To: 2042
24/09/11 18:20, Leo
> 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.
That's much better! Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2011-09-24 16:20 ` Leo
2011-09-25 8:54 ` Antoine Levitt
@ 2011-10-01 19:10 ` Chong Yidong
2011-10-02 0:04 ` Leo
1 sibling, 1 reply; 12+ messages in thread
From: Chong Yidong @ 2011-10-01 19:10 UTC (permalink / raw
To: Leo; +Cc: Antoine Levitt, 2042
Leo <sdl.web@gmail.com> writes:
> 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.
Could you explain in words what the existing code tries to do?
Maybe it's indeed misguided and ought to be taken out, but it would be
good to first figure out what the original intention was.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2011-10-01 19:10 ` Chong Yidong
@ 2011-10-02 0:04 ` Leo
2011-10-29 6:38 ` Chong Yidong
0 siblings, 1 reply; 12+ messages in thread
From: Leo @ 2011-10-02 0:04 UTC (permalink / raw
To: Chong Yidong; +Cc: Antoine Levitt, 2042
On 2011-10-02 03:10 +0800, Chong Yidong wrote:
> Leo <sdl.web@gmail.com> writes:
>
>> 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.
>
> Could you explain in words what the existing code tries to do?
>
> Maybe it's indeed misguided and ought to be taken out, but it would be
> good to first figure out what the original intention was.
The existing code gives different precedence to different match type:
full-matches > suffix matches > prefix matches > remaining matches
For example in switching buffers in ido:
input: ab
Buffer: ab[c]{abcd | abc | xabcd | xabc}
now when the user types c, it changes to:
Buffer: abc{abc | abcd | xabcd | xabc}
Note the different ordering of "abcd" and "abc". Because typing is so
much quicker than observing the new order, one usually mis-chooses a
match.
Thus, the above strategy may break down when the original ordering is
meaningful for example, (buffer-list) returns a list in order of
recency.
Leo
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2011-10-02 0:04 ` Leo
@ 2011-10-29 6:38 ` Chong Yidong
2011-10-29 7:06 ` Leo
2012-09-16 9:29 ` Matthew Woodcraft
0 siblings, 2 replies; 12+ messages in thread
From: Chong Yidong @ 2011-10-29 6:38 UTC (permalink / raw
To: Leo; +Cc: Antoine Levitt, 2042
Leo <sdl.web@gmail.com> writes:
> The existing code gives different precedence to different match type:
>
> full-matches > suffix matches > prefix matches > remaining matches
>
> For example in switching buffers in ido:
>
> input: ab
>
> Buffer: ab[c]{abcd | abc | xabcd | xabc}
>
> now when the user types c, it changes to:
>
> Buffer: abc{abc | abcd | xabcd | xabc}
>
> Note the different ordering of "abcd" and "abc". Because typing is so
> much quicker than observing the new order, one usually mis-chooses a
> match.
Thanks. I guess since at least two users of ido have complained about
this behavior, and no one else has chimed in, we can go ahead and make
this change after the release.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2011-10-29 6:38 ` Chong Yidong
@ 2011-10-29 7:06 ` Leo
2012-09-16 9:29 ` Matthew Woodcraft
1 sibling, 0 replies; 12+ messages in thread
From: Leo @ 2011-10-29 7:06 UTC (permalink / raw
To: 2042
On 2011-10-29 14:38 +0800, Chong Yidong wrote:
> Thanks. I guess since at least two users of ido have complained about
> this behavior, and no one else has chimed in, we can go ahead and make
> this change after the release.
OK. Maybe we can also add a user option.
Leo
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2011-10-29 6:38 ` Chong Yidong
2011-10-29 7:06 ` Leo
@ 2012-09-16 9:29 ` Matthew Woodcraft
2012-09-16 14:55 ` Leo
1 sibling, 1 reply; 12+ messages in thread
From: Matthew Woodcraft @ 2012-09-16 9:29 UTC (permalink / raw
To: Chong Yidong; +Cc: 2042, Leo, Antoine Levitt
On 29 Oct 2011, Chong Yidong <cyd@gnu.org> wrote:
> Thanks. I guess since at least two users of ido have complained about
> this behavior, and no one else has chimed in, we can go ahead and make
> this change after the release.
I've been running with Leo's patch from this bug report for a couple of
months.
I also think that the changed behaviour is an improvement, and I've seen
no problems.
So could this be considered before the 24.3 freeze?
-M-
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2012-09-16 9:29 ` Matthew Woodcraft
@ 2012-09-16 14:55 ` Leo
2012-09-16 15:03 ` Leo
0 siblings, 1 reply; 12+ messages in thread
From: Leo @ 2012-09-16 14:55 UTC (permalink / raw
To: Matthew Woodcraft; +Cc: Chong Yidong, 2042, Antoine Levitt
On 2012-09-16 17:29 +0800, Matthew Woodcraft wrote:
> I've been running with Leo's patch from this bug report for a couple of
> months.
>
> I also think that the changed behaviour is an improvement, and I've seen
> no problems.
>
> So could this be considered before the 24.3 freeze?
If Yidong doesn't object, I plan to commit something along these lines:
diff --git a/lisp/ido.el b/lisp/ido.el
index fe94c7f2..bb019574 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -493,6 +493,17 @@ (defcustom ido-enable-dot-prefix nil
:type 'boolean
:group 'ido)
+;; See http://debbugs.gnu.org/2042 for more info.
+(defcustom ido-buffer-disable-smart-matches t
+ "Non-nil means not to re-order matches for buffer switching.
+By default, ido aranges matches in the following order:
+
+ full-matches > suffix matches > prefix matches > remaining matches
+
+which can get in the way for buffer switching."
+ :type 'boolean
+ :group 'ido)
+
(defcustom ido-confirm-unique-completion nil
"Non-nil means that even a unique completion must be confirmed.
This means that \\[ido-complete] must always be followed by \\[ido-exit-minibuffer]
@@ -3688,10 +3699,15 @@ (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))
+ (full-re (and do-full
+ (not ido-buffer-disable-smart-matches)
+ (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))
+ (not ido-buffer-disable-smart-matches)
+ (not ido-enable-regexp)
+ (not (string-match "\$\\'" rex0))
(concat rex0 "/\\'")))
(prefix-re (and full-re (not ido-enable-prefix)
(concat "\\`" rexq)))
^ permalink raw reply related [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2012-09-16 14:55 ` Leo
@ 2012-09-16 15:03 ` Leo
2012-09-16 16:33 ` Chong Yidong
0 siblings, 1 reply; 12+ messages in thread
From: Leo @ 2012-09-16 15:03 UTC (permalink / raw
To: 2042
Use this patch instead:
diff --git a/lisp/ido.el b/lisp/ido.el
index fe94c7f2..512ac9d4 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -493,6 +493,17 @@ (defcustom ido-enable-dot-prefix nil
:type 'boolean
:group 'ido)
+;; See http://debbugs.gnu.org/2042 for more info.
+(defcustom ido-buffer-disable-smart-matches t
+ "Non-nil means not to re-order matches for buffer switching.
+By default, ido aranges matches in the following order:
+
+ full-matches > suffix matches > prefix matches > remaining matches
+
+which can get in the way for buffer switching."
+ :type 'boolean
+ :group 'ido)
+
(defcustom ido-confirm-unique-completion nil
"Non-nil means that even a unique completion must be confirmed.
This means that \\[ido-complete] must always be followed by \\[ido-exit-minibuffer]
@@ -3688,10 +3699,17 @@ (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))
+ (full-re (and do-full
+ (and (eq ido-cur-item 'buffer)
+ (not ido-buffer-disable-smart-matches))
+ (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))
+ (and (eq ido-cur-item 'buffer)
+ (not ido-buffer-disable-smart-matches))
+ (not ido-enable-regexp)
+ (not (string-match "\$\\'" rex0))
(concat rex0 "/\\'")))
(prefix-re (and full-re (not ido-enable-prefix)
(concat "\\`" rexq)))
^ permalink raw reply related [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2012-09-16 15:03 ` Leo
@ 2012-09-16 16:33 ` Chong Yidong
0 siblings, 0 replies; 12+ messages in thread
From: Chong Yidong @ 2012-09-16 16:33 UTC (permalink / raw
To: Leo; +Cc: 2042
Leo <sdl.web@gmail.com> writes:
> Use this patch instead:
Feel free to commit, and thanks for writing up the patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#2042: Ido-mode : filtering does not keep ordering
2009-01-25 13:54 bug#2042: Ido-mode : filtering does not keep ordering Antoine Levitt
2011-09-24 16:20 ` Leo
@ 2012-09-16 22:28 ` Leo
1 sibling, 0 replies; 12+ messages in thread
From: Leo @ 2012-09-16 22:28 UTC (permalink / raw
To: 2042-done
Fixed in emacs-24
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-09-16 22:28 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-25 13:54 bug#2042: Ido-mode : filtering does not keep ordering Antoine Levitt
2011-09-24 16:20 ` Leo
2011-09-25 8:54 ` Antoine Levitt
2011-10-01 19:10 ` Chong Yidong
2011-10-02 0:04 ` Leo
2011-10-29 6:38 ` Chong Yidong
2011-10-29 7:06 ` Leo
2012-09-16 9:29 ` Matthew Woodcraft
2012-09-16 14:55 ` Leo
2012-09-16 15:03 ` Leo
2012-09-16 16:33 ` Chong Yidong
2012-09-16 22:28 ` Leo
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.