From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11472 invoked from network); 24 Mar 1999 12:30:04 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Mar 1999 12:30:04 -0000 Received: (qmail 20859 invoked by alias); 24 Mar 1999 12:29:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5925 Received: (qmail 20852 invoked from network); 24 Mar 1999 12:29:25 -0000 Date: Wed, 24 Mar 1999 13:29:22 +0100 (MET) Message-Id: <199903241229.NAA20957@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Wed, 24 Mar 1999 13:41:23 +0300 Subject: RE: PATCH: cleanup in zle_tricky.c Andrej Borsenkow wrote: > Now, that I have been working with this a bit more, the result of this patch > is somewhat unexpected. Now, the /a/b/c/d expands the prefix even if nothing > would match. Returning to my expamle - the bug with /u/i/s/*.h was, that > this does match, but the match failed (because of bug). And current > /u/i/s/*.c -> /usr/include/sys/*.c is a bit too much ... > > ... > > May I suggest, that this change would be backed off? Probably, with > configuration option (but I fail to see, when it would be useful). If direct > completion of /a/b/c/d fails, this is the job for approximate/correcting > completion then. > > To be more precise - the change makes prefix to be expanded even if nothing > matches. I did not intend it, and did not ask for it. Without `GLOB_COMPLETE' you need this to make `/u/i/s/*.h' to expand the path, because there is no file named `*.h' (there are only files matching `*.h' which isn't tested without `GLOB_COMPLETE'). Anyway, I've made it configurable (set `compconf path_expand=yes'), because I also like to be able to do `:> com/cor/_frob' to expand the path even if `_frob' doesn't exist already. Bye Sven diff -u -r oc/Core/_path_files Completion/Core/_path_files --- oc/Core/_path_files Wed Mar 24 13:19:00 1999 +++ Completion/Core/_path_files Wed Mar 24 13:21:35 1999 @@ -12,6 +12,14 @@ # like files with one of the suffixes in the `fignore' array in normal # completion. # +# This function supports one configuration key: +# +# path_expand +# If this is set to a non-empty string, the partially typed path +# from the line will be expanded as far as possible even if trailing +# pathname components can not be completed. +# +# # This function uses the helper functions `_match_test' and `_match_pattern'. # First see if we should generate matches for the global matcher in use. @@ -454,7 +462,8 @@ exppaths=( "${(@)exppaths:#$orig}" ) -if [[ nm -eq compstate[nmatches] && $#exppaths -ne 0 ]]; then +if [[ -n "$compconfig[path_expand]" && + nm -eq compstate[nmatches] && $#exppaths -ne 0 ]]; then compadd -UQ -S '' "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" - \ "${linepath}${(@)^exppaths}" fi diff -u -r oc/README Completion/README --- oc/README Wed Mar 24 13:19:01 1999 +++ Completion/README Wed Mar 24 13:23:04 1999 @@ -152,7 +152,7 @@ You can configure several aspects of the completion functions and the overall completion behavior using the compconf shell function defined -in compinit. This function get any number of arguments of the form +in compinit. This function gets any number of arguments of the form `key=value', where `key' is one of the keys described below and `value' is any string. Most configuration keys are defined by the completer functions. @@ -333,7 +333,14 @@ to the one completion was called on the last time will not delay the generation of matches. - For more information about what the completers do, see the files containing them (_complete, _correct, _approximate, _match, and _expand in the Core directory). + +The _path_files function used to complete filenames has one +configuration key: + + path_expand + If this is set to a non-empty string, the partially typed path + from the line will be expanded as far as possible even if trailing + pathname components can not be completed. -- Sven Wischnowsky wischnow@informatik.hu-berlin.de