Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Problem with fake-files style and cd

On 27 May 2011 17:06, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On May 27,  4:24pm, Mikael Magnusson wrote:
> } Subject: Re: Problem with fake-files style and cd
> }
> } Or is this better?
> }
> } item(tt(directories))(
> } for names of directories DASH()- tt(local-directories) is used instead
> } when completing arguments of tt(cd) and related builtin commands when
> } the tt(cdpath) array is set
> I like that one, but either is fine.

Okay, good :).

> } I think it's enough that the entry for local-directories refers the
> } reader to path-directories. It's heavily implied that path-directories
> } does nothing when cdpath is empty too. What is the motivation though?
> zsh-workers/8869 (twelve years ago):
>  This makes _cd use the tags local-directories and path-directories to
>  decide if those in the cwd and/or those in $cdpath should be
>  completed.
>  I.e. you can put in your _sort_tags:
>   *::cd:*)
>       comptry local-directories
>       comptry path-directories
>       ;;
>  to first complete only the directories in $PWD and the ones in $cdpath
>  only if that fails.
> Obviously this predates a whole lot of mechansim that now exists; e.g.,
> _sort_tags is now the tag-order style.  There's a follow-up from me in
> workers/8878 and then Sven in 8880 (not properly linked in the archive).
> } Why not just always have just 'directories' and then also look up
> } path-directories when cdpath is set, otherwise not? Does someone
> } actually want local directories to complete differently depending on
> } $cdpath?
> If you have two directories with the same name, one local and one in
> a directory in cdpath, you may want that name to appear twice so you
> know which one you're actually cd'ing into.  Otherwise the duplicate
> would be suppressed when generating the completion listing.

Would it? One would be in 'directories' and one would be in
'path-directories', same as now except the first one is in
local-directories. What I meant was path-directories would stay, but
local-directories would be folded into directories, since they never
appear at the same time anyway. I suppose the issue is academic since
we can't break existing configurations though.

> Of course (as discussed in 8878 and 8880) it would be silly to use
> the tags to order the completions differently than the way cdpath is
> used by cd et al.  Hmm, there might be a way with the tags to cause
> completion to explicitly expand paths (force "$PWD/" in front of the
> local-directories, for example) to eliminate the ambiguity, but I'm
> not going to try to figure that out.

Do you mean in front of the path-directories? cd goes to local
directories first, and then cdpath.

Mikael Magnusson

Messages sorted by: Reverse Date, Date, Thread, Author