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

Re: Interesting tidbit about bash completion



On 28 Feb, you wrote:
> 
> 
>   Just saw this in the "bash programmable completion" freshmeat projects
> update:
> 
> # bash completion is now compatible with the new bash completion
> # emulation feature of zsh.
> 
>   What does this mean (if anything) to us?

The change is little more than changing a few ugly bashisms like:
  if [ ${BASH_VERSINFO[1]} '>' 04 ]; then
to:
  if [[ ${BASH_VERSINFO[1]} > 04 ]]; then

I sent them a patch to do that to save me the hassle of having to modify
/etc/bash_completion before sourcing it from zsh.

If anyone is interested, I use this function to source it:
bash_source() {
  alias shopt=':'
  alias _expand=_bash_expand
  alias _complete=_bash_comp
  emulate -L sh
  setopt kshglob noshglob braceexpand

  source "$@"
}

This is only useful for testing bashcompinit because it will override
lots of zsh completions. You could alias around all zsh functions with:
  for f in ${(kM)functions:#_*}; alias $f=_bash_$f
and then use:
  alias compdef='compdef -n'
when running bashcompinit (so don't use the -U option to autoload)
I could perhaps put _bash_source in bashcompinit and add a -n option so
that it uses compdef -n.

Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.



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