From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3237 invoked from network); 16 Feb 2000 11:20:17 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Feb 2000 11:20:17 -0000 Received: (qmail 2781 invoked by alias); 16 Feb 2000 11:19:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9761 Received: (qmail 2613 invoked from network); 16 Feb 2000 11:18:06 -0000 Message-ID: <38AA876E.64EFE7EE@u.genie.co.uk> Date: Wed, 16 Feb 2000 11:18:06 +0000 From: Oliver Kiddle X-Mailer: Mozilla 4.7 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: zsh-workers@sunsite.auc.dk Subject: Re: help with _match, globcomplete etc. (with a PATCH) References: <200002161011.LAA16009@beta.informatik.hu-berlin.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sven Wischnowsky wrote: > Err, substitution is done in lines 30/31, so your new style only says > that it should offer expansion only if attempting globbing did change > the word resulting from substitution (given that I don't really > understand the style name but maybe I'm the only one). I think it's > fine to have that configurable. Globbing wouldn't work without substitution being done first where there are variables etc in the line. The option allows me to have the benefit of globbing (at the expense of substition) in these cases without having substition for everything. So the effect is that only globbed things are substituted hence the name subst-only-globs. If anyone can think of a better name, its easily changed. > Well, I'd say since the completion code normally adds slashes for > directories we probably don't need a style for it as long as we add it > with `-qS/', i.e. auto-removable. A patch for this follows then. --- Completion/Core/_expand.bak2 Wed Feb 16 10:58:09 2000 +++ Completion/Core/_expand Wed Feb 16 10:58:18 2000 @@ -7,7 +7,7 @@ # the expansions done produce no result or do not change the original # word from the line. -local exp word="$PREFIX$SUFFIX" sort expr expl subd +local exp word="$PREFIX$SUFFIX" sort expr expl subd suf=" " local curcontext="${curcontext/:[^:]#:/:expand:}" # First, see if we should insert all *completions*. @@ -41,7 +41,7 @@ zstyle -s ":completion:${curcontext}:" glob expr && [[ "${(e):-\$[$expr]}" -eq 1 ]] && exp=( ${~exp}(N) ) - + # If we don't have any expansions or only one and that is the same # as the original string, we let other completers run. @@ -60,16 +60,19 @@ [[ "$sort" = (yes|true|1|on) ]] && exp=( "${(@o)exp}" ) +# If there is only one expansion, add a suitable suffix +(($#exp == 1)) && suf='' && [[ -d $exp ]] && suf='/' + if [[ -z "$compstate[insert]" ]] ;then _description all-expansions expl 'all expansions' "o:$word" - compadd "$expl[@]" -UQ - "$exp" + compadd "$expl[@]" -UQ -qS "$suf" - "$exp" else _tags all-expansions expansions original _requested all-expansions expl 'all expansions' "o:$word" && - compadd "$expl[@]" -UQ "$exp" + compadd "$expl[@]" -UQ -qS "$suf" - "$exp" if _requested expansions; then if [[ "$sort" = menu ]]; then