From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13199 invoked from network); 20 Jan 2000 09:12:44 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 20 Jan 2000 09:12:44 -0000 Received: (qmail 28730 invoked by alias); 20 Jan 2000 09:12:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9383 Received: (qmail 28722 invoked from network); 20 Jan 2000 09:12:39 -0000 To: Sven Wischnowsky Cc: zsh-workers@math.gatech.edu Subject: Re: completion after // References: <200001191642.RAA19840@beta.informatik.hu-berlin.de> X-Attribution: adl From: Alexandre Duret-Lutz Date: 20 Jan 2000 10:12:26 +0100 In-Reply-To: Sven Wischnowsky's message of "Wed, 19 Jan 2000 17:42:39 +0100 (MET)" Message-ID: User-Agent: Gnus/5.070096 (Pterodactyl Gnus v0.96) Emacs/20.5 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>> "Sven" == Sven Wischnowsky writes: [...] Sven> I fear it will mess up completion inside braces (only if both multiple Sven> slashes and braces are used at the same time), but: try it. Using a Sven> style for it, of course ;-) [...] Here is the patch that add a squeeze-slashes style for that. I couldn't find any problem with braces completion, but maybe I wasn't looking the right direction. Index: Doc/Zsh/compsys.yo --- Doc/Zsh/compsys.yo Wed, 19 Jan 2000 21:50:19 +0100 Alexandre +++ Doc/Zsh/compsys.yo Thu, 20 Jan 2000 10:09:48 +0100 Alexandre @@ -1160,6 +1160,36 @@ as single strings (not in the string containing all possible expansions). ) +item(tt(special-dirs))( +Normally, the completion code will not produce the directory names +tt(.) and tt(..) as possible completions. If this style is set to +`true', it will add both `tt(.)' and `tt(..)' as possible completions, +if it is set to tt(..), only `tt(..)' will be added. +) +item(tt(squeeze-slashes))( +If set to `true', sequences of slashes (such as tt(foo//bar)) will +be rewritten with a single slash (tt(foo/bar)) when completing +directory names. +) +item(tt(stop))( +If set to `true', the tt(_history_complete_word) bindable +command will always insert matches as if menucompletion were started +and it will stop when the last match is inserted. If this style is set +to tt(verbose) a message will be displayed when the last match is reached. +) +item(tt(substitute))( +If this is unset or set to the empty string, the tt(_expand) completer +will first try to expand all substitutions in the string (such as +`tt($LPAR()...RPAR())' and `tt(${...})'). If this is set to an +non-empty string it should be an expression usable inside a `tt($((...)))' +arithmetical expression. In this case, expansion of substitutions will +be done if the expression evaluates to `tt(1)'. For example, with + +example(zstyle ':completion:expand' substitute '${NUMERIC:-1} != 1') + +substitution will be performed only if given an explicit numeric +argument other than `tt(1)', as by typing `tt(ESC 2 TAB)'. +) item(tt(tag-order))( This provides a mechanism for sorting how the tags available in a particular context will be used. @@ -1195,31 +1225,6 @@ of how such functions can be implemented. If no style has been defined for a context, all tags will be used. -) -item(tt(special-dirs))( -Normally, the completion code will not produce the directory names -tt(.) and tt(..) as possible completions. If this style is set to -`true', it will add both `tt(.)' and `tt(..)' as possible completions, -if it is set to tt(..), only `tt(..)' will be added. -) -item(tt(stop))( -If set to `true', the tt(_history_complete_word) bindable -command will always insert matches as if menucompletion were started -and it will stop when the last match is inserted. If this style is set -to tt(verbose) a message will be displayed when the last match is reached. -) -item(tt(substitute))( -If this is unset or set to the empty string, the tt(_expand) completer -will first try to expand all substitutions in the string (such as -`tt($LPAR()...RPAR())' and `tt(${...})'). If this is set to an -non-empty string it should be an expression usable inside a `tt($((...)))' -arithmetical expression. In this case, expansion of substitutions will -be done if the expression evaluates to `tt(1)'. For example, with - -example(zstyle ':completion:expand' substitute '${NUMERIC:-1} != 1') - -substitution will be performed only if given an explicit numeric -argument other than `tt(1)', as by typing `tt(ESC 2 TAB)'. ) item(tt(users))( This may be set to a list of names that should be completed whenever Index: Completion/Core/_path_files --- Completion/Core/_path_files Wed, 19 Jan 2000 21:50:19 +0100 Alexandre +++ Completion/Core/_path_files Thu, 20 Jan 2000 09:47:19 +0100 Alexandre @@ -157,6 +157,14 @@ fi fi +# Squeeze sequences of slashes +if zstyle -t ":completion${curcontext}:paths" squeeze-slashes +then + PREFIX="${PREFIX//(\\/)#//}" + SUFFIX="${SUFFIX//(\\/)#//}" + [[ $PREFIX = */ ]] && SUFFIX=${SUFFIX#/} +fi + # We get the prefix and the suffix from the line and save the whole # original string. Then we see if we will do menucompletion. Index: Completion/Builtins/_zstyle --- Completion/Builtins/_zstyle Fri, 14 Jan 2000 10:25:34 +0100 Alexandre +++ Completion/Builtins/_zstyle Thu, 20 Jan 2000 10:10:04 +0100 Alexandre @@ -18,6 +18,7 @@ cursor c:bool disable-stat c:bool expand c: + file-patterns c: format c: glob c: group-name c: @@ -49,6 +50,7 @@ sort c:bool tag-order c:tag special-dirs c:sdirs + squeeze-slashes c:bool stop c:stop substitute c: users c:_users -- Alexandre Duret-Lutz