From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22203 invoked from network); 21 Feb 2000 20:03:34 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Feb 2000 20:03:34 -0000 Received: (qmail 17773 invoked by alias); 21 Feb 2000 20:03:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9827 Received: (qmail 17763 invoked from network); 21 Feb 2000 20:03:24 -0000 To: zsh-workers@sunsite.auc.dk Subject: PATCH: Re: Style names In-reply-to: "Sven Wischnowsky"'s message of "Mon, 21 Feb 2000 09:49:53 +0100." <200002210849.JAA04770@beta.informatik.hu-berlin.de> Date: Mon, 21 Feb 2000 20:07:09 +0000 From: Peter Stephenson Message-Id: Sven Wischnowsky wrote: > Peter Stephenson wrote: > > The particular problem is with `menu' and `list' in _oldlist, and > > `original' in _match. These do slightly different things to the same > > styles when used elsewhere --- this is explicit in the manual --- so that > > you need to alter the context to make the style change a different feature. > > This is a little unnatural, and more importantly for my purpose harder to > > do automatically. I'd like to suggest, therefore, that the styles for > > these uses be renamed to old-menu, old-list and match-original (or some > > other set to be agreed upon). Then I can simply whack them in without > > worrying about altering the context. > > I think that's ok. Probably even less confusing for users anyway. The documentation certainly looks a little tidier now. I've renamed zftp's remote_glob style to remote-glob. I was using the former as a key to the configuration array before styles came along. Index: Completion/Core/_match =================================================================== RCS file: /home/pws/CVSROOT/projects/zsh/Completion/Core/_match,v retrieving revision 1.6 diff -u -r1.6 _match --- Completion/Core/_match 2000/02/20 18:44:45 1.6 +++ Completion/Core/_match 2000/02/21 19:34:05 @@ -19,7 +19,7 @@ tmp="${${:-$PREFIX$SUFFIX}#[~=]}" [[ "$tmp:q" = "$tmp" ]] && return 1 -zstyle -s ":completion:${curcontext}:" original orig +zstyle -s ":completion:${curcontext}:" match-original orig zstyle -b ":completion:${curcontext}:" insert-unambiguous ins # Try completion without inserting a `*'? Index: Completion/Core/_oldlist =================================================================== RCS file: /home/pws/CVSROOT/projects/zsh/Completion/Core/_oldlist,v retrieving revision 1.4 diff -u -r1.4 _oldlist --- Completion/Core/_oldlist 2000/02/20 18:44:45 1.4 +++ Completion/Core/_oldlist 2000/02/21 19:32:10 @@ -4,10 +4,10 @@ local curcontext="${curcontext/:[^:]#:/:oldlist:}" list -zstyle -s ":completion:${curcontext}:" list list +zstyle -s ":completion:${curcontext}:" old-list list # If this is a listing widget and there is already an old list, -# and either the style :oldlist:list is `always', or it is not `never' +# and either the style :oldlist:old-list is `always', or it is not `never' # and the list is not already shown, then use the existing list for listing # (even if it was generated by another widget). # Do this also if there is an old list and it was generated by the @@ -30,13 +30,13 @@ fi # If this is a completion widget, and we have a completion inserted already, -# and the style :oldlist:menu is `true', then we cycle through the +# and the style :oldlist:old-menu is `true', then we cycle through the # existing list (even if it was generated by another widget). if [[ -z $compstate[old_insert] && -n $compstate[old_list] ]]; then compstate[old_list]=keep elif [[ $WIDGET = *complete(|-prefix|-word) ]] && - zstyle -t ":completion:${curcontext}:" menu; then + zstyle -t ":completion:${curcontext}:" old-menu; then if [[ -n $compstate[old_insert] ]]; then compstate[old_list]=keep if [[ $WIDGET = *reverse* ]]; then Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /home/pws/CVSROOT/projects/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.31 diff -u -r1.31 compsys.yo --- Doc/Zsh/compsys.yo 2000/02/21 19:30:00 1.31 +++ Doc/Zsh/compsys.yo 2000/02/21 19:40:06 @@ -989,38 +989,10 @@ tt(ALWAYS_LAST_PROMPT) option. ) item(tt(list))( -This is used by the tt(_oldlist) completer (context -`tt(:completion:oldlist)'), the tt(_history_complete_word) bindable command +This is used by the tt(_history_complete_word) bindable command (context `tt(:completion:history-words)') and by the tt(incremental-complete-word) widget (context `tt(:completion:incremental)). -For tt(_oldlist), if this is set to tt(always), then standard -widgets which perform listing will retain the current list of matches, -however they were generated. If it is set to tt(never), this will not -be done (the behaviour without the tt(_oldlist) completer). If it is -unset, or any other value, then the existing list of completions will -be displayed if it is not already; otherwise, the standard completion -list will be generated: this is the default behaviour of -tt(_oldlist). However, if there is an old list and this style contains -the name of the completer function that generated the list, then the -old list will be used even if it was generated by a widget which does -not do listing. - -For example, suppose you type tt(^Xc) to use the tt(_correct_word) -widget, which generates a list of corrections for the word under the -cursor. Usually, typing tt(^D) would generate a standard list of -completions for the word on the command line, and show that. With -tt(_oldlist), it will instead show the list of corrections already -generated. - -As another example consider the tt(_match) completer: with the -tt(insert-unambiguous) style set to `true' it inserts only an -unambiguous prefix string if there is any. But since this may remove -parts of the original pattern, attempting completion again may result -in more matches than on the first attempt. But by using the -tt(_oldlist) completer and setting this style to tt(_match), the list of -matches generated on the first attempt will be used again. - The tt(_history_complete_word) bindable command uses this style to decide if the available matches should be shown. @@ -1083,6 +1055,14 @@ directory name used by a user placing web pages within their home area. ) +item(tt(match-original))( +This is used by the tt(_match) completer. If it is set to +tt(only), tt(_match) will try to generate matches without inserting a +`tt(*)' at the cursor position. If set to any other non-empty value, +it will first try to generate matches without inserting the `tt(*)' +and if that yields no matches, it will try again with the `tt(*)' +inserted. +) item(tt(matcher))( This style is tested for tags used when generating matches. Its value is used as an additional match specification to use when adding the @@ -1188,8 +1168,46 @@ smallest one is taken). Starting menuselection can explicitly be turned off by defining a value containing the string tt(no-select). +) +item(tt(numbers))( +This is used with the tt(jobs) tag. If it is `true', the completions +will use the job numbers instead of the shortest unambiguous strings +of the jobs' command lines. If the value is a number, job numbers will +only be used if for at least one of the jobs that many (or more) words +from the command line string have to be used to make the strings +unambiguous. E.g. if it is set to `tt(1)', strings will only be used +if all jobs differ in the first word on their command lines. +) +item(tt(old-list))( +This is used by the tt(_oldlist) completer. If this is set to tt(always), +then standard widgets which perform listing will retain the current list of +matches, however they were generated. If it is set to tt(never), this will +not be done (the behaviour without the tt(_oldlist) completer). If it is +unset, or any other value, then the existing list of completions will +be displayed if it is not already; otherwise, the standard completion +list will be generated: this is the default behaviour of +tt(_oldlist). However, if there is an old list and this style contains +the name of the completer function that generated the list, then the +old list will be used even if it was generated by a widget which does +not do listing. + +For example, suppose you type tt(^Xc) to use the tt(_correct_word) +widget, which generates a list of corrections for the word under the +cursor. Usually, typing tt(^D) would generate a standard list of +completions for the word on the command line, and show that. With +tt(_oldlist), it will instead show the list of corrections already +generated. -This is also used by the tt(_oldlist) completer. Here it controls how menu +As another example consider the tt(_match) completer: with the +tt(insert-unambiguous) style set to `true' it inserts only an +unambiguous prefix string if there is any. But since this may remove +parts of the original pattern, attempting completion again may result +in more matches than on the first attempt. But by using the +tt(_oldlist) completer and setting this style to tt(_match), the list of +matches generated on the first attempt will be used again. +) +item(tt(old-menu))( +This is used by the tt(_oldlist) completer. Here it controls how menu completion behaves when a completion has already been inserted and the user types a standard completion key type such as tt(TAB). The default behaviour of tt(_oldlist) is that menu completion always continues @@ -1204,32 +1222,15 @@ appears. With tt(_oldlist), it will instead continue to cycle through the list of completions. ) -item(tt(numbers))( -This is used with the tt(jobs) tag. If it is `true', the completions -will use the job numbers instead of the shortest unambiguous strings -of the jobs' command lines. If the value is a number, job numbers will -only be used if for at least one of the jobs that many (or more) words -from the command line string have to be used to make the strings -unambiguous. E.g. if it is set to `tt(1)', strings will only be used -if all jobs differ in the first word on their command lines. -) item(tt(original))( -This is used by the tt(_approximate), tt(_correct) and tt(_match) -completers. The first two use it to decide if the original string should -be added as one possible completion. Normally, this is done only if -there are -at least two possible corrections, but if this style is set to `true', it +This is used by the tt(_approximate) and tt(_correct) +completers to decide if the original string should be added as +one possible completion. Normally, this is done only if there are +at least two possible corrections, but if this style is set to `true', it will always be added. Note that these completers use this style after setting the completer field in the context name to tt(correct-)var(num) or tt(approximate-)var(num), where var(num) is the number of errors that were accepted. - -For the tt(_match) completer, if this style is set to -tt(only), it will try to generate matches without inserting a -`tt(*)' at the cursor position. If set to any other non-empty value, -it will first try to generate matches without inserting the `tt(*)' -and if that yields no matches, it will try again with the `tt(*)' -inserted. ) item(tt(packageset))( A style containing an override for the default package set @@ -1634,8 +1635,8 @@ Normally this will be done by taking the pattern from the line, inserting a `tt(*)' at the cursor position and comparing the resulting pattern with the possible completions generated. However, if the -tt(original) style has a value of tt(only), no `tt(*)' will be -inserted. If tt(original) has any other non-empty string as its +tt(match-original) style has a value of tt(only), no `tt(*)' will be +inserted. If tt(match-original) has any other non-empty string as its value, this completer will first try to generate matches without, then with a `tt(*)' inserted at the cursor position. @@ -1693,8 +1694,8 @@ when there is an existing list of completions which may have been generated by a special completion (i.e. a separately-bound completion command). It should appear in the list of completers before any of -the widgets which generate matches. It uses two styles: tt(list) and -tt(menu), see +the widgets which generate matches. It uses two styles: tt(old-list) and +tt(old-menu), see ifzman(the section `Completion System Configuration' above)\ ifnzman(noderef(Completion System Configuration)). ) Index: Doc/Zsh/zftpsys.yo =================================================================== RCS file: /home/pws/CVSROOT/projects/zsh/Doc/Zsh/zftpsys.yo,v retrieving revision 1.5 diff -u -r1.5 zftpsys.yo --- Doc/Zsh/zftpsys.yo 1999/12/21 15:18:27 1.5 +++ Doc/Zsh/zftpsys.yo 2000/02/21 19:43:34 @@ -554,7 +554,7 @@ As described for tt(progress), tt(zfinit) will force this to default to 1. ) -item(tt(remote_glob))( +item(tt(remote-glob))( If set to `1', `yes' or `true', filename generation (globbing) is performed on the remote machine instead of by zsh itself; see below. ) @@ -598,7 +598,7 @@ if retrieved, will be cached, so that subsequent globs in the same directory without an intervening tt(zfcd) are much faster. -If the tt(remote_glob) style (see above) is set, globbing is instead +If the tt(remote-glob) style (see above) is set, globbing is instead performed on the remote host: the server is asked for a list of matching files. This is highly dependent on how the server is implemented, though typically UNIX servers will provide support for basic glob patterns. This Index: Functions/Zftp/zfrglob =================================================================== RCS file: /home/pws/CVSROOT/projects/zsh/Functions/Zftp/zfrglob,v retrieving revision 1.2 diff -u -r1.2 zfrglob --- Functions/Zftp/zfrglob 1999/12/15 19:11:27 1.2 +++ Functions/Zftp/zfrglob 2000/02/21 19:40:49 @@ -9,7 +9,7 @@ # stick with a single directory. This is the default. # (2) Use remote globbing, i.e. pass it to ls at the site. # Faster, but only works with UNIX, and only basic globbing. -# We do this if the remote_glob style (or $zfrglob for +# We do this if the remote-glob style (or $zfrglob for # backward compatibility) is set. # There is only one argument, the variable containing the @@ -21,7 +21,7 @@ local pat dir nondir files i zfrglob -zstyle -t "$curcontext" remote_glob && zfrglob=1 +zstyle -t "$curcontext" remote-glob && zfrglob=1 eval pat=\$$1 -- Peter Stephenson