On Tue, 3 May 2011 11:27:42 +0100, Peter Stephenson wrote: > On Mon, 2 May 2011 11:16:06 +0200 > Haakon Riiser wrote: >> By the way: When defining sub-functions inside a completion >> function, is it recommended to test for their existence before >> defining them? E.g., >> >> (( $+functions[_ffmpeg_foo] )) || _ffmpeg_foo() { >> ... >> } >> >> I see this in a lot of completers included with zsh, and I assumed >> it was done for performance reasons (although it seems strange that >> the performance hit could be significant, considering that the code >> is only executed once per TAB keypress). > > That's certainly normal, but I think it's less for performance > reasons > than to allow you to overrided _ffmpeg_foo (or whatever) in another > file. Note that the (( ... )) expression is true even if _ffmpeg_foo > is > marked for autoload. Ah, I see. Doesn't seem to be a reason not to do this then, so I used the same convention for the other stuff I added. Attached to this email you will find a patch that implements toggle flags using the method you posted earlier in this thread (thanks again for that, btw). The ffmpeg completion function is pretty cryptic now, but at least it should be very complete and _very_ future-proof. :) -- Haakon