zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@berkom.de>
To: zsh-workers@sunsite.dk
Subject: Re: Redirection completion
Date: Tue, 12 Mar 2002 10:03:53 +0100	[thread overview]
Message-ID: <15501.50297.139401.277883@wischnow.berkom.de> (raw)
In-Reply-To: <1020311165607.ZM27129@candle.brasslantern.com>


[I'm withholding the patch for now...]

Many questions from Bart:

> ...
> 
> Firstly I'd like to keep the "flavor" of redirection tightly associated
> with the word `redirect', i.e. rather than
> 
> 	-redirect-echo-2>
> 
> It should be
> 
> 	-redirect-2>-echo

That's ok, I think.  What do you suggest for values, then?
`-value-<name>-<type>-<command>'?  <name> is the parameter name,
<type> is scalar/array/... and <command> is only set when completing
after something like `make FOO=<TAB>'.  That, by the way, is the
reason why I put the command directly after the `-value-' or
`-redirect-': it can be there in both cases.

> Then, I think, it would not be necessary to try each of `-redirect-',
> `-redirect-2>', and `-redirect-2>-echo' in turn, because styles could be
> written easily with wildcards e.g. `-redirect-*' or `-redirect-2>*'.
> 
> Unless I'm missing something about why all three are tried?

Yes.  The main reason for this is that I want it to be easy to define
functions (not styles) for types of redirections or for parameters
without having to use `compdef -[pP]' everywhere.

> This points up the second change I'd like to request:  Make this style
> fragment work the same way that styles in general work, e.g., define a
> fixed set of delimiter-separated segments and have them always be there
> even if sometimes empty.  E.g. supposing we switched to comma as the
> delimiter, as Sven tossed out in one of the earlier messages on this
> thread, the context would look like `-redirect-,2>,echo' and if for some
> reason the command name were not known it would be `-redirect-,2>,'.

I've actually been thinking the same (before that idea with the
comma).  I'd prefer a solution where the different can have at least
almost the same meaning in every case, though (i.e. values and
parameters for now).  Just as we did with full context names.

> I suppose strictly speaking the first of those commas could be omitted
> because we must always know what redirection operator we're dealing with
> (else we wouldn't be in -redirect- context at all), e.g. `-redirect-2>,'.

If we go this way, I'd be in favour of putting it there -- it might
also make the description in the docs easier (`some functions
redispatch and modify the context name to show this, leaving the base
name of the command/context field and appending to it the more precise
description, separated by commas').

> Random additional comments:
> 
> If we do stick with hyphens, what does the context look like in the case
> of completion after:
> 
> zsh% - 2>
> 
> (It's perfectly legal syntax to put the redirection anywhere on the line,
> even before the command for which the precommand modifier is intended.)

Since completion for redirection is determined on the same lave as
_precommand would be found, you should (haven't tried) currently get
`-' in the command part.  Hrm, that's ugly, obviously, because you
would get the same for `- foo > <TAB>'.  We've got to thnk some more
about this...

> If we instead switch to commas, what do we do in case of a command named
> `,'? (I knew people in grad school who used a csh script named that, for
> reasons too obscure to go into).  On a similar note, do we need to fix
> somehow the existing contexts for completing after the `:' command?

Hrm.  We could quote the separation character if it appears inside the
command name.

> Different tack:  If I have
> 
> zsh% ls >
> 
> with the cursor positioned ON the `>', what context(s) get tried when I
> press TAB?  I might expect it to complete file descriptor numbers ...
> and in that case, I'd want to complete only the numbers of *valid* file
> descriptors, but those aren't available to shell functions (yet).

Yes that would be nice.

Currently you should get argument completion (but strangely, trying
`echo ><TAB>' shows that `-command-' is tried, only after `echo foo ><TBA>'
do we get argument completion -- I'll have to have a look).


Bye
  Sven

-- 
Sven Wischnowsky                          wischnow@berkom.de


  reply	other threads:[~2002-03-12  9:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-08 12:33 Peter Stephenson
2002-03-08 12:54 ` Sven Wischnowsky
2002-03-08 14:06   ` Peter Stephenson
2002-03-08 14:10     ` Sven Wischnowsky
2002-03-11  8:42       ` Sven Wischnowsky
2002-03-11  9:58         ` Sven Wischnowsky
2002-03-11 10:54         ` Peter Stephenson
2002-03-11 11:16           ` Sven Wischnowsky
2002-03-11 11:29             ` Peter Stephenson
2002-03-11 12:08               ` Sven Wischnowsky
2002-03-11 14:01                 ` Peter Stephenson
2002-03-11 16:56                 ` Bart Schaefer
2002-03-12  9:03                   ` Sven Wischnowsky [this message]
2002-03-12 13:16         ` Oliver Kiddle
2002-03-13  9:25           ` Sven Wischnowsky
2002-03-13 16:55             ` Peter Stephenson
2002-03-14 12:03               ` Sven Wischnowsky
2002-03-13 17:58             ` Oliver Kiddle
2002-03-13 18:19               ` Bart Schaefer
2002-03-14 13:51                 ` Oliver Kiddle
2002-03-14 14:41                   ` Peter Stephenson
2002-03-14 14:43                     ` Sven Wischnowsky
2002-03-08 13:20 ` Oliver Kiddle

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=15501.50297.139401.277883@wischnow.berkom.de \
    --to=wischnow@berkom.de \
    --cc=zsh-workers@sunsite.dk \
    /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).