From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7059 invoked from network); 5 Oct 2001 11:55:38 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Oct 2001 11:55:38 -0000 Received: (qmail 25409 invoked by alias); 5 Oct 2001 11:55:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15945 Received: (qmail 25396 invoked from network); 5 Oct 2001 11:55:30 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15293.40881.289353.876742@gargle.gargle.HOWL> Date: Fri, 5 Oct 2001 13:55:29 +0200 To: zsh-workers@sunsite.dk Subject: Re: Completion behaviour in 4.1.0-dev-1 In-Reply-To: References: X-Mailer: VM 6.92 under 21.1 (patch 3) "Acadia" XEmacs Lucid martin.ebourne@arcordia.com wrote: > I've just upgraded from Zsh 4.0.2 to 4.1.0-dev-1, and I've noticed a change > in completion behaviour. > > If I do: > > % zsh -f > gdd-odybin2% autoload -U compinit > gdd-odybin2% compinit -C > gdd-odybin2% setopt cdablevars > gdd-odybin2% zstyle ':completion:*:complete:cd:*' tag-order local-directories > gdd-odybin2% cd c > > I get a list of local directories, users, and anything else cd can make use > of. If I do this on 4.0.2 then I only get local directories, assuming one > matches - otherwise I get the other stuff - which is what I want. > > In 4.1.0 I get only the local directories if I do 'cd ', just like in > 4.0.2. It's only when I've added the 'c' that it gives the full list. Yes, we had some trouble with _cd. The patch below hopefully makes this better configurable, using the named-directories tag for anything completed by _tilde. Bye Sven Index: Completion/Zsh/Command/_cd =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_cd,v retrieving revision 1.4 diff -u -r1.4 _cd --- Completion/Zsh/Command/_cd 2001/08/22 15:37:19 1.4 +++ Completion/Zsh/Command/_cd 2001/10/05 11:54:17 @@ -32,13 +32,17 @@ fi if [[ $PREFIX != (\~|/|./|../)* ]]; then - local tmpcdpath + local tmpcdpath alt + tmpcdpath=(${${(@)cdpath:#.}:#$PWD}) + (( $#tmpcdpath )) && + alt=( 'path-directories:directory in cdpath:_path_files -W tmpcdpath -/' ) + # With cdablevars, we can complete foo as if ~foo/ if [[ -o cdablevars && -n "$PREFIX" && "$PREFIX" != <-> ]]; then if [[ "$PREFIX" != */* ]]; then - _tilde && ret=0 + alt=( "$alt[@]" 'named-directories: : _tilde' ) else local oipre="$IPREFIX" opre="$PREFIX" dirpre dir @@ -51,26 +55,22 @@ PREFIX="${PREFIX#*/}" [[ $#dir -eq 1 && "$dir[1]" != "~$dirpre" ]] && - _wanted named-directories expl 'directories after cdablevar' \ + _wanted named-directories expl 'directory after cdablevar' \ _path_files -W dir -/ && ret=0 PREFIX="$opre" IPREFIX="$oipre" fi - fi - if [[ $#tmpcdpath -ne 0 ]]; then - # Don't complete local directories in command position, that's - # already handled by _command_names (see _autocd) - if [[ CURRENT -eq 1 ]]; then - _wanted path-directories expl 'directories in cdpath' \ - _path_files -W tmpcdpath -/ && ret=0 - else - _alternative \ - 'local-directories:local directories:_path_files -/' \ - "path-directories:directories in cdpath:_path_files -W tmpcdpath -/" && ret=0 - fi - return ret fi + # Don't complete local directories in command position, that's + # already handled by _command_names (see _autocd) + + [[ CURRENT -ne 1 ]] && + alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" ) + + _alternative "$alt[@]" && ret=0 + + return ret fi _wanted directories expl directory _path_files -/ && ret=0 -- Sven Wischnowsky wischnow@informatik.hu-berlin.de