From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6466 invoked from network); 28 Jan 2000 09:49:37 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 Jan 2000 09:49:37 -0000 Received: (qmail 26985 invoked by alias); 28 Jan 2000 09:49:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9453 Received: (qmail 26976 invoked from network); 28 Jan 2000 09:49:30 -0000 To: zsh-workers@math.gatech.edu Cc: Sven Wischnowsky Subject: Re: PATCH: _diff (new), _prcs (upgrade) References: <200001280826.JAA20090@beta.informatik.hu-berlin.de> X-Attribution: adl From: Alexandre Duret-Lutz Date: 28 Jan 2000 10:49:54 +0100 In-Reply-To: Sven Wischnowsky's message of "Fri, 28 Jan 2000 09:26:42 +0100 (MET)" Message-ID: User-Agent: Gnus/5.070096 (Pterodactyl Gnus v0.96) Emacs/20.5 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>> "Sven" == Sven Wischnowsky writes: Sven> Alexandre Duret-Lutz wrote: [...] Sven> Oh, and it makes _diff_options use `$(command diff ...)' -- I at least Sven> have a small wrapper function for it which makes it fail otherwise. >> >> I first wrote this, and then removed 'command' when I thought that on a >> system without GNU diff a user may have installed GNU diff and made diff be >> an alias to GNU diff. But maybe it's quite uncommon especially with diff >> (which is used by several commands and is thus better put in the PATH). >> >> Also, I should say: I understand why _pids is running $(command ps ...) >> but the difference in _diff_options is that we should be testing the >> command that the user is actually running. I rethought about it this morning, and while I have not changed my idea, I can describe it differently. My opinion is: we should write $(XXX) if we are in the completion function for XXX, and $(command XXX) otherwise. In the former case, we really need to see what the user is actually running, in order to not complete for the wrong command (that's the case in _diff, I think); in the later case we need to call a command directly in order to get unaltered result (case of the call to ps in _pids). Sven> Actually, I wasn't too sure about _pids either... the problem is that Sven> some users may have functions for ps, diff, and so on that may give Sven> completely different results when invoked in the way we invoke them. Sven> Hm. maybe we should try to solve this in a generic manner by writing a Sven> function that is called in such cases, like: Sven> _call [ ] Sven> (i.e. we use `$(_diff ps)', `$(_call ps list)' and so on). $(_call diff version)? Sven> _call would then first see if there is a style `command-line' for the Sven> tag `' or, if is given, -. If there is such a Sven> style it is used as an array containing the whole command line to use Sven> (the styles for ps we have now would be removed). Sven> If there is no such style, and $+functions[] is 1, we use Sven> `command ', otherwise we use just `'. I'm not sure to understand this default behaviour, what would be the default for a - call? (where will arguments come from?). $(diff -v ] test: what if I am writting a completion function for a shell function? say I need to call it, how do I do? [...] -- Alexandre Duret-Lutz