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

Re: compinit causes completion to fail?




On Monday, April 30, 2012 at 10:37 AM, Bart Schaefer wrote:

> Future hint: Uncomment half the lines, then try. If it works, leave
> those uncommented and uncomment half the remaining lines. If it fails,
> re-comment half way back to the last place it succeeded. Repeat.
>  
> (Binary search usually takes fewer comparisons than linear search.)
Oh, I know… I remember that from CS101 all those years ago… I actually did group a few of them, but I had a few false positives and negatives (I think due to ~/.zcompdump not being deleted) so eventually I just went to the awfukkit stage of debugging. :-)
  
> Turns out compinit uses "read" to parse #compdef lines while walking
> $fpath. When IFS=$'\n' the entire line is in the first element of
> the array, so compdef is run with the wrong arguments. Then compdef
> itself uses "read" to parse bindkey output, etc.
>  
> I'm not sure if it's worthwhile to fix this as having IFS=$'\n' during
> a whole interactive shell session is likely to cause all sorts of havoc,
> but here's a patch anyway.

FWIW I have used

IFS='
'

in my .zshrc for ages, and it has actually proven very helpful as far as parsing arrays, etc. I realize it's not the ideal solution but this is the first time that I know of that it has caused a problem.

Then again, my usage of zsh is so basic that I may not be attempting some of the things which would have otherwise caused problems.

Thanks again for your time. I can't tell you how many times I've googled something about ZSH only to find the answer from some online cache of this mailing list.

TjL





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