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

Re: zle messes up 'words' variable?



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)



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