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

Re: more wishes with automounter

On Sep 11,  7:33pm, Alexandre Duret-Lutz wrote:
} Subject: more wishes with automounter
}    /nfs/hosts1 -> /var/autofs/nfs/host1
}    /nfs/hosts2 -> /var/autofs/nfs/host2
}    /nfs/hosts3 -> /var/autofs/nfs/host3
} etc...
} The problem is that using Zsh to complete /nfs/hos<TAB> will
} mount *all* the directories, because the completion code stat()
} all links (and stat()ing a link will lead to the mount of the
} linked directory).  I believe that Zsh may use lstat() instead,
} but since I don't know where that guilty stat() is I haven't
} tried.

I think the stat must be an effect of the way _path_files does globbing
to try to segregate files by type.  I don't see any stat() calls in
strace output if I don't have any styles set (and this time I did check
that the new completion system really was loaded (blush)).

Try this:

    ztyle -e ':completion:*' file-patterns \
      '[[ $PREFIX == /nfs/[^/]# ]] && \
        { setopt noglob ; reply=(*(@)) ; setopt glob }'

(Twaddling noglob like that was the only way I could get zstyle -e to put
a file pattern into $reply -- the eval-ing messed up any other quoting I
could think of.)  This just says that if you're completing within the
/nfs/ directory itself, don't consider anything other than symlinks.  As
I'm not sure why/where those links are getting stat()d, this may not be
of any help ... but then again, it may.

} [*] another wish would be that Zsh complete those invisible
}     directories; or more generaly: give the user the possiblity
}     to add "virtual files" (anywhere he want), that Zsh would
}     use for completion.

The article that PWS referenced about this is zsh-users/3408.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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