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

Re: bash comp env missing



On Fri, 04 Jan 2013 13:32:12 +0100
Frank Becker <fb@xxxxxxxxx> wrote:
> I am trying to use an external bash complete program using the
> bashcompinit auto completion function.
> 
> The external auto complete program needs the two environment variables
> 
> COMP_POINT
> export COMP_LINE
> 
> In zsh/functions/bashcompinit those two variables are not exported.
> 
> If I add
> 	export COMP_POINT
> 	export COMP_LINE
> there everything works as expected.
> 
> Question: How do I use bashcompinit correctly so the external program
> can access the two environment variables?

It ought to be good enough to export them only from _bash_complete while
they are needed.

Index: Completion/bashcompinit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/bashcompinit,v
retrieving revision 1.5
diff -p -u -r1.5 bashcompinit
--- Completion/bashcompinit	29 Jan 2012 18:23:54 -0000	1.5
+++ Completion/bashcompinit	4 Jan 2013 13:04:21 -0000
@@ -3,9 +3,9 @@
 _bash_complete() {
   local ret=1
   local -a suf matches
-  local COMP_POINT COMP_CWORD
+  local -x COMP_POINT COMP_CWORD
   local -a COMP_WORDS COMPREPLY BASH_VERSINFO
-  local COMP_LINE="$words"
+  local -x COMP_LINE="$words"
   local -A savejobstates savejobtexts
 
   (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))

pws



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