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

Re: Two missing completion functions that bug me



On Mar 30, 10:16am, Oliver Kiddle wrote:
} Subject: Re: Two missing completion functions that bug me
}
} --- Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
} 
} > You're right; upon another attempt, none of -c, -e, nor -h need the
} > `+'.
} 
} The plus says that the argument to the option can appear in the same or
} subsequent word.

Yes, but when you're allowed to have other options intervene between an
option and its argument (as in `tar -fxv file' for example) there has to
be some way to prevent completion from inserting the space after `-f'.
In _rpm this is done by using both `+' and ->state so that options keep
completing in the same word and only when there are none possible (or
the next word is being completed) does the state machine get used to
supply the argument.

} The solution would be to use a state for the last (parameter) argument

However, I didn't think this much effort was worthwhile for vared, as
the number of options is small and they're not often used in combination
except in script/function context.

} and make it check $opt_args and select either _vars or _parameters
} depending on this. I'm not sure whether it is worth it to do this
} because -A and -a are only of any use if combined with -c so when
} creating a new array which won't exist to be completed anyway.

Not entirely true: `vared -ca scalar' changes the type of an existing
scalar to an array, as if you'd done `scalar=($scalar)'.  Same for -cA.

} I got confused as to why the r variant of fc allows -l.

So you can do `r -l FIRST [ LAST ]' for a listing.  It's just for those
too lazy to type a two-letter command name.  If you don't use the -l,
the commands from FIRST to LAST are actually *executed*.

} What should it take?

Anything that `fc' does, with the exception of `-e'.  The -e option is
ignored by fc and friends when -l is given so that you can have an
alias for `fc -e jove' or whatever (which is all `r' really is) and
still use the alias to get listings.

} Are getln and pushln of any use interactively? I got confused trying to
} alter _read and _print for them.

I've never had occasion to use them interactively, but I could conjure
a hypothetical scenario if pressed.

} pwd and echo would be fairly doable if we ignore the possibility of
} someone disabling them or using /bin/pwd.

We really need a way to do `whence' to discover whether $service is a
builtin or an external, without having to fork a process and parse its
output.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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