We had a discussion a few months ago about the behavior of ido when
one types a slash.
I'm still not satisfied by the current bevavior. In particular, I
often have directories like:
./XXX/
./XXX-aaa/
./XXX-bbb/
./XXX-ccc/
Then, at the prompt, I get
./XXX/{XXX-aaa,XXX-bbb,XXX-ccc,XXX}
and I have no "fast" way to open XXX itself, while it would have been
trivial to open it without ido.
I propose a new possible value for ido-enter-matching-directory, which
enters the directory when there is an exact match, whether or not it's
the first. In the case above, I type the slash after having typed XXX
which is the exact name of a directory, so we enter this directory. If
we want to open another directory, we have to type some more
characters before typing the slash. Below is a patch implementing
this.
--- ido.el.orig
+++ ido.el
@@ -742,11 +742,15 @@
If value is 'first, enter first matching sub-directory when typing a slash.
If value is 'only, typing a slash only enters the sub-directory if it is
the only matching item.
+If value is 'exact, enter the directory if it is an exact match (even
+ if there are other possibilities and even if the match is not the
+ first choice).
If value is t, automatically enter a sub-directory when it is the only
matching item, even without typing a slash."
:type '(choice (const :tag "Never" nil)
(const :tag "Slash enters first directory" first)
(const :tag "Slash enters first and only directory" only)
+ (const :tag "Slash enters directory on exact match" exact)
(other :tag "Always enter unique directory" t))
:group 'ido)
@@ -4180,6 +4184,13 @@
(ido-set-current-directory
(concat ido-current-directory (file-name-directory contents)))
(setq refresh t))
+ ((and (eq ido-enter-matching-directory 'exact)
+ (member contents ido-matches))
+ (ido-trace "exact match" (car ido-matches))
+ (ido-set-current-directory
+ (concat ido-current-directory contents))
+ (setq ido-exit 'refresh)
+ (exit-minibuffer))
(t
(ido-trace "try single dir")
(setq try-single-dir-match t))))
--
Matthieu
_______________________________________________ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug