[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] another possible behavior for ido-enter-matching-directory

From: Kim F. Storm
Subject: Re: [PATCH] another possible behavior for ido-enter-matching-directory
Date: Sat, 12 Aug 2006 00:16:00 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Matthieu Moy" <address@hidden> writes:

> ./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.

Thanks for the idea.  I'll consider it.

> --- 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

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]