From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29915 invoked from network); 4 Feb 2000 10:56:07 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Feb 2000 10:56:07 -0000 Received: (qmail 7999 invoked by alias); 4 Feb 2000 10:55:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9562 Received: (qmail 7989 invoked from network); 4 Feb 2000 10:55:55 -0000 Date: Fri, 4 Feb 2000 11:55:54 +0100 (MET) Message-Id: <200002041055.LAA23286@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Oliver Kiddle's message of Fri, 04 Feb 2000 08:39:58 +0000 Subject: Re: A couple of completion problems Oliver Kiddle wrote: > When establishing if a file is executable, symbolic links are not being > followed: > > :>test1 > chmod 755 test1 > ln -s test1 test2 > ./t > > This will just complete to test1 - test2 is ignored. This is in > 3.1.6-dev-17; it works in 3.0.6. This is part of a more general problem: we weren't using the `-' in the glob qualifiers in several places. This should fix it for all executable files. There are some cases of `*(/)' in some of the User functions. Since I don't know anything about the programs using them, I'll leave it to someone else to decide if they should be changed to `*(-/)'. > The second problem occurs when completing configure: > > cd /usr/local/src/zsh-3.1.6-dev-17 > ./configure --enable-fndir -- > > Here, nothing is completed. > > Basically, completion doesn't work after a --enable-fndir which isn't > followed by '=' and a value. It may nolonger be the case but I think > that I have --enable-fndir in my usual zsh configure because it is > needed for functions to be installed; giving it a value would just > override the default directory. Anyway, it is certainly generally > possible for the parameters to arguments to be optional so completion > should work after them. 1) There was a buglet in computil that kept options from being completed in positions of optional arguments. 2) Do you really think we should *always* allow option completion after long options? I think the --help output should list such options as -foo[=bar] then (and if it does, _arguments makes the argument optional). Or the caller function should have a pattern that says that -foo= options should take their argument as being optional (the hunk in _arguments below should make that work, too). So, what do you all think: should we make all automatically found options take their argument as being optional? Should we leave it to the calling functions? Or should we add a style that can be used to give a set of patterns and all options with matching names have their argument turned into an optional one? Bye Sven diff -ru ../z.old/Completion/Base/_arg_compile Completion/Base/_arg_compile --- ../z.old/Completion/Base/_arg_compile Fri Feb 4 11:00:11 2000 +++ Completion/Base/_arg_compile Fri Feb 4 11:24:27 2000 @@ -71,7 +71,7 @@ # option -d follow close means "debug level" \ # option -k means "function names" action '->pair' \ # option -m means "minimum execution count" \ -# argument means executable action '_files -g \*\(\*\)' \ +# argument means executable action '_files -g \*\(-\*\)' \ # argument means "profile file" action '_files -g gmon.\*' \ # help '*=name*' means "function name" action '->funcs' \ # help '*=dirs*' means "directory" action _dir_list diff -ru ../z.old/Completion/Base/_arguments Completion/Base/_arguments --- ../z.old/Completion/Base/_arguments Fri Feb 4 11:00:11 2000 +++ Completion/Base/_arguments Fri Feb 4 11:54:04 2000 @@ -134,11 +134,7 @@ tmp=("${(@)tmp:#*\=*}") tmpo=("${(@)${(@)tmpo%%\=*}//[^a-z0-9-]}") - if [[ "$descr" = ::* ]]; then - cache=( "$cache[@]" "${(@)^tmpo}=${descr[2,-1]}" ) - else - cache=( "$cache[@]" "${(@)^tmpo}=${descr}" ) - fi + cache=( "$cache[@]" "${(@)^tmpo}=${descr}" ) fi # Everything else is just added as a option without arguments. diff -ru ../z.old/Completion/Base/_command_names Completion/Base/_command_names --- ../z.old/Completion/Base/_command_names Fri Feb 4 11:00:11 2000 +++ Completion/Base/_command_names Fri Feb 4 11:20:19 2000 @@ -8,7 +8,7 @@ defs=( 'commands:external command:compadd - ${(@k)commands}' - 'executables:executable file or directory:_path_files -/g \*\(\*\)' + 'executables:executable file or directory:_path_files -/g \*\(-\*\)' ) if [[ "$1" = -e ]]; then diff -ru ../z.old/Completion/Builtins/_hash Completion/Builtins/_hash --- ../z.old/Completion/Builtins/_hash Fri Feb 4 11:00:14 2000 +++ Completion/Builtins/_hash Fri Feb 4 11:22:38 2000 @@ -11,7 +11,7 @@ fi elif compset -P 1 '*='; then _wanted -C value values expl 'executable file' && - _files "$expl[@]" -g '*(*)' + _files "$expl[@]" -g '*(-*)' else _wanted -C name commands expl command && compadd "$expl[@]" -q -S '=' - "${(@k)commands}" diff -ru ../z.old/Completion/User/_gdb Completion/User/_gdb --- ../z.old/Completion/User/_gdb Fri Feb 4 11:00:24 2000 +++ Completion/User/_gdb Fri Feb 4 11:24:55 2000 @@ -4,7 +4,7 @@ [[ "$PREFIX" = --* ]] && _arguments -- '*=(CORE|SYM)FILE:core file:_files' \ - '*=EXECFILE:executable:_files \*\(\*\)' \ + '*=EXECFILE:executable:_files \*\(-\*\)' \ '*=TTY:terminal device:compadd /dev/tty\*' && return 0 if compset -P '-(cd|directory)='; then @@ -13,7 +13,7 @@ _wanted devices expl 'terminal device' && compadd "$expl[@]" - /dev/tty* elif compset -P '-(exec|se)='; then _description files expl executable - _files "$expl[@]" -g '*(*)' + _files "$expl[@]" -g '*(-*)' elif compset -P '-(symbols|core|command)='; then _files elif [[ "$PREFIX" = -* ]]; then @@ -30,7 +30,7 @@ (-d) _files -/ && return 0 ;; (-[csx]) _files && return 0 ;; (-e) _description files expl executable - _files "$expl[@]" -g '*(*)' && return 0 ;; + _files "$expl[@]" -g '*(-*)' && return 0 ;; (-b) _wanted -V values expl 'baud rate' && compadd "$expl[@]" 0 50 75 110 134 150 200 300 600 1200 1800 \ 2400 4800 9600 19200 38400 57600 115200 \ @@ -47,6 +47,6 @@ _alternative 'files:: _files' "processes:: _pids -m ${w[1]:t}" else _description files expl executable - _files "$expl[@]" -g '*(*)' + _files "$expl[@]" -g '*(-*)' fi fi diff -ru ../z.old/Completion/User/_ssh Completion/User/_ssh --- ../z.old/Completion/User/_ssh Fri Feb 4 11:00:27 2000 +++ Completion/User/_ssh Fri Feb 4 11:25:26 2000 @@ -91,7 +91,7 @@ ;; *(#i)xauthlocation*) _description files expl 'xauth program' - _files "$expl[@]" -g '*(*)' && ret=0 + _files "$expl[@]" -g '*(-*)' && ret=0 ;; esac else @@ -155,7 +155,7 @@ '-c[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' \ '-P[specify port on remote host]:port number on remote host:' \ '-i[select identity file]:SSH identity file:_files' \ - '-S[specify path to ssh]:path to ssh:_files -g \*\(\*\)' \ + '-S[specify path to ssh]:path to ssh:_files -g \*\(-\*\)' \ '-o[give SSH options]:options:->options' \ '-p[preserve modification times]' \ '-r[recursively copy directories]' \ diff -ru ../z.old/Completion/User/_strip Completion/User/_strip --- ../z.old/Completion/User/_strip Fri Feb 4 11:00:27 2000 +++ Completion/User/_strip Fri Feb 4 11:25:34 2000 @@ -3,4 +3,4 @@ local expl _description files expl executable -_files "$expl[@]" -g '*(*)' +_files "$expl[@]" -g '*(-*)' diff -ru ../z.old/Completion/X/_xrdb Completion/X/_xrdb --- ../z.old/Completion/X/_xrdb Fri Feb 4 11:00:31 2000 +++ Completion/X/_xrdb Fri Feb 4 11:25:45 2000 @@ -3,7 +3,7 @@ _arguments \ -{help,all,global,screen,screens,n,quiet,nocpp,symbols,query,load,merge,remove,retain} \ '-display:display:_x_display' \ - '-cpp:preprocessor program:_files -g \*\(\*\)' \ + '-cpp:preprocessor program:_files -g \*\(-\*\)' \ '-edit:file to insert:_files' \ '-backup:suffix for backup: ' \ '*:defaults file:_files' diff -ru ../z.old/Completion/X/_xutils Completion/X/_xutils --- ../z.old/Completion/X/_xutils Fri Feb 4 11:00:31 2000 +++ Completion/X/_xutils Fri Feb 4 11:25:57 2000 @@ -138,7 +138,7 @@ '(-global -all -screens)-screen' \ '(-global -all -screen)-screens' \ '-n[only display on stdout]' \ - '(-nocpp)-cpp:preprocessor program:_files -g \*\(\*\)' \ + '(-nocpp)-cpp:preprocessor program:_files -g \*\(-\*\)' \ '(-cpp)-nocpp' \ '(-load -override -merge -remove)-query' \ '(-query -override -merge -remove)-load' \ diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c --- ../z.old/Src/Zle/computil.c Fri Feb 4 11:00:41 2000 +++ Src/Zle/computil.c Fri Feb 4 11:39:48 2000 @@ -1406,7 +1406,8 @@ return 1; } case 'O': - if (ca_laststate.opt || (ca_laststate.doff && ca_laststate.def)) { + if (ca_laststate.opt || (ca_laststate.doff && ca_laststate.def) || + (ca_laststate.def && ca_laststate.def->type == CAA_OPT)) { LinkList next = newlinklist(); LinkList direct = newlinklist(); LinkList odirect = newlinklist(); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de