Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

something strange with compset and/or _normal



I try to complete after sudo; the relevant part (albeit clumsy) is

if [[ $cmd -gt 0 ]] && compset -n $cmd
then
    _normal

where ``cmd'' is position of command to execute and is computed somewhere
else.

Unfortunately, that is what I get in log:

+ local comp
+ setopt localoptions nullglob rcexpandparam
+ unsetopt markdirs globsubst shwordsplit nounset ksharrays
+ compset -P 1 \=
+ [[ /t != */* ]]
+ ((  0  ))
+ set _complete _match
+ _complete
+ local comp name
+ [[ -n  ]]
+ comp=_first
+ [[ ! -z _first ]]
+ _first
+ ((  0  ))
+ [[ command == command ]]
+ _normal
+ local comp command cmd1 cmd2 pat val name i ret=1
+ command=sudo
+ [[ CURRENT -eq 1 ]]
+ [[ s == = ]]
+ [[ sudo == */* ]]
+ cmd1=sudo
+ cmd2=+ whence -p sudo
+ cmd2=/tools/bin/sudo
+ pat=zf*
+ val=_zftp
+ [[ sudo == zf* || /tools/bin/sudo == zf* ]]
+ name=sudo
+ comp=_sudo
+ [[ -z _sudo ]]
+ [[ -z _sudo ]]
+ [[ -z _sudo ]]
+ _sudo
+ emulate -L zsh
+ local -i i=1 cmd=0
+ [[ 1 -lt 3 ]]
+ [[ 2 -gt 2 ]]
+ cmd=2
+ break
+ [[ 2 -gt 0 ]]
+ compset -n 2
+ _normal
+ local comp command cmd1 cmd2 pat val name i ret=1
+ command=umount
+ [[ CURRENT -eq 1 ]]
+ [[ u == = ]]
+ [[ umount == */* ]]
+ cmd1=umount
+ cmd2=+ whence -p umount
+ cmd2=/usr/sbin/umount
+ pat=zf*
+ val=_zftp
+ [[ umount == zf* || /usr/sbin/umount == zf* ]]
+ name=umount
+ comp=_umount
+ [[ -z _umount ]]
+ [[ -z _umount ]]
+ [[ -z _umount ]]
+ _sudo


Oops! Why is _sudo called instead of _umount?

/andrej



Messages sorted by: Reverse Date, Date, Thread, Author