From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26915 invoked from network); 27 Jan 2000 16:08:42 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Jan 2000 16:08:42 -0000 Received: (qmail 17917 invoked by alias); 27 Jan 2000 16:08:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9441 Received: (qmail 17909 invoked from network); 27 Jan 2000 16:08:37 -0000 Date: Thu, 27 Jan 2000 17:08:36 +0100 (MET) Message-Id: <200001271608.RAA19165@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Alexandre Duret-Lutz's message of 27 Jan 2000 15:52:23 +0100 Subject: Re: PATCH: _diff (new), _prcs (upgrade) Alexandre Duret-Lutz wrote: > Here is a diff completion fonction. I have separated _diff_options > (complete options) from _diff (also complete filenames), so that > completion functions like _prcs may use only _diff_options. Testing this revealed a thinko in _files -- sometimes ignored-patterns was effectively ignored. The rest of the patch just makes some of the descriptions more verbose. I hope this is ok for Alexandre (?). Oh, and it makes _diff_options use `$(command diff ...)' -- I at least have a small wrapper function for it which makes it fail otherwise. Bye Sven diff -ru ../z.old/Completion/Core/_files Completion/Core/_files --- ../z.old/Completion/Core/_files Thu Jan 27 16:48:00 2000 +++ Completion/Core/_files Thu Jan 27 17:02:48 2000 @@ -1,6 +1,7 @@ #autoload local opts opt type=file glob group gopts dopts aopts tmp _file_pat_checked=yes +local hasign ign opts=() group=() @@ -9,11 +10,12 @@ aopts=(-f) while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:12n" opt; do case "$opt" in - /) type="${type}dir" ;; - g) type="${type}glob"; gopts=(-g "$OPTARG") ;; - [qn12]) opts=("$opts[@]" "-$opt" ) ;; - [JV]) group=( "-$opt" "$OPTARG") ;; - [^f]) opts=("$opts[@]" "-$opt" "$OPTARG") ;; + /) type="${type}dir" ;; + g) type="${type}glob"; gopts=(-g "$OPTARG") ;; + [qn12]) opts=("$opts[@]" "-$opt" ) ;; + [JV]) group=( "-$opt" "$OPTARG") ;; + F) opts=("$opts[@]" "-$opt" "$OPTARG"); hasign=yes ;; + [^f]) opts=("$opts[@]" "-$opt" "$OPTARG") ;; esac done @@ -60,32 +62,44 @@ if (( $#group )); then group[2]=all-files _setup all-files + [[ -z "$hasign" ]] && + zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore && + ign=(-F _comp_ignore) fi - _path_files "$opts[@]" "$aopts[@]" + _path_files "$opts[@]" "$ign[@]" "$aopts[@]" return elif _requested directories; then if _requested globbed-files; then if (( $#group )); then group[2]=globbed-files _setup globbed-files + [[ -z "$hasign" ]] && + zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore && + ign=(-F _comp_ignore) fi - _path_files "$opts[@]" "$dopts[@]" "$gopts[@]" && return 0 + _path_files "$opts[@]" "$ign[@]" "$dopts[@]" "$gopts[@]" && return 0 else if (( $#group )); then group[2]=directories _setup directories + [[ -z "$hasign" ]] && + zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore && + ign=(-F _comp_ignore) fi - _path_files "$opts[@]" "$dopts[@]" && return 0 + _path_files "$opts[@]" "$ign[@]" "$dopts[@]" && return 0 fi elif _requested globbed-files; then if (( $#group )); then group[2]=globbed-files _setup globbed-files + [[ -z "$hasign" ]] && + zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore && + ign=(-F _comp_ignore) fi if [[ "$type" = (*dir*glob*|*glob*dir*) ]]; then - _path_files "$opts[@]" "$dopts[@]" "$gopts[@]" && return 0 + _path_files "$opts[@]" "$ign[@]" "$dopts[@]" "$gopts[@]" && return 0 else - _path_files "$opts[@]" "$gopts[@]" && return 0 + _path_files "$opts[@]" "$ign[@]" "$gopts[@]" && return 0 fi fi done diff -ru ../z.old/Completion/User/_diff_options Completion/User/_diff_options --- ../z.old/Completion/User/_diff_options Thu Jan 27 16:48:13 2000 +++ Completion/User/_diff_options Thu Jan 27 16:52:50 2000 @@ -4,7 +4,7 @@ (( $+_diff_is_gnu )) || { _diff_is_gnu=0; - [[ $(diff -v