zsh-workers
 help / color / mirror / code / Atom feed
From: Alexandre Duret-Lutz <duret_g@epita.fr>
To: zsh-workers@math.gatech.edu
Cc: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
Subject: Re: PATCH: _diff (new), _prcs (upgrade)
Date: 28 Jan 2000 10:49:54 +0100	[thread overview]
Message-ID: <mvbpuumwmnx.fsf@phobos.lrde.epita.fr> (raw)
In-Reply-To: Sven Wischnowsky's message of "Fri, 28 Jan 2000 09:26:42 +0100 (MET)"

>>> "Sven" == Sven Wischnowsky <wischnow@informatik.hu-berlin.de> 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 <name> [ <how> ]

 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 `<name>' or, if <how> is given, <name>-<how>. 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[<name>] is 1, we use
 Sven> `command <name>', otherwise we use just `<name>'.

I'm not sure to understand this default behaviour, what would be
the default for a <name>-<how> call? (where will arguments come
from?).


  $(diff -v </dev/null)

would be replaced by

  $(_call diff version)

with something like

 zstyle '*:diff-version' command-line 'diff -v </dev/null'

where is this last line going to be?  will every completion function
have to pollute compinit to set such default?


Another point about the $+functions[<name>] 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


  reply	other threads:[~2000-01-28  9:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-28  8:26 Sven Wischnowsky
2000-01-28  9:49 ` Alexandre Duret-Lutz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-01-31  9:09 Sven Wischnowsky
2000-01-28 15:11 Sven Wischnowsky
2000-01-28 16:24 ` Alexandre Duret-Lutz
2000-01-28 10:25 Sven Wischnowsky
2000-01-28 15:04 ` Alexandre Duret-Lutz
2000-01-27 16:08 Sven Wischnowsky
2000-01-27 17:21 ` Alexandre Duret-Lutz
2000-01-29  8:49 ` Alexandre Duret-Lutz
2000-01-27 14:52 Alexandre Duret-Lutz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mvbpuumwmnx.fsf@phobos.lrde.epita.fr \
    --to=duret_g@epita.fr \
    --cc=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).