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

Re: zle messes up 'words' variable?



On Tue, May 3, 2011 at 6:04 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On May 3,  7:39am, Bart Schaefer wrote:
> }
> } ... bashcompinit has responsibility
> } for loading the bash completion functions in a way that makes them
> } compatible.  That's not the same as first loading bashcompinit and
> } then independently defining a new completion, though I lean toward
> } the conclusion that use of the bash-compatible "complete" command is
> } probably the correct place to fix this if it can be managed.
>
> Try this:
>
> Index: Completion/bashcompinit
> ===================================================================
> diff -c -r1.2 bashcompinit
> --- Completion/bashcompinit     22 Jun 2004 07:53:03 -0000      1.2
> +++ Completion/bashcompinit     3 May 2011 15:01:09 -0000
> @@ -120,7 +120,13 @@
>       ;;
>       F)
>         COMPREPLY=()
> -       $OPTARG "${words[0]}" "${words[CURRENT-1]}" "${words[CURRENT-2]}"
> +        (){
> +          set -- "${words[0]}" "${words[CURRENT-1]}" "${words[CURRENT-2]}"
> +          # There may be more things we need to add to this typeset to
> +          # protect bash functions from compsys special variable names
> +          typeset -h words
> +          $OPTARG "$@"
> +        }
>        results+=( "${COMPREPLY[@]}" )
>       ;;
>       G)

Yeap, that fixes it :)

So I think this should be committed to zsh. Now, that's part a of the problem.

Part b is how to workaround the issue in the current versions of zsh,
which is what the git guys are trying to do:
http://article.gmane.org/gmane.comp.version-control.git/172371

I guess simply setting 'typeset -h words' on the top-level function
(_git) should do the trick.

Cheers.

-- 
Felipe Contreras



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