From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@math.gatech.edu
Subject: Re: compctl -Tx 'w[0,...] ...' ...
Date: Mon, 29 Sep 1997 08:29:17 +0200 [thread overview]
Message-ID: <9709290629.AA08437@gamma.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Fri, 26 Sep 1997 12:45:53 -0700
"Bart Schaefer" wrote:
>
> What's the difference between
>
> compctl ... -- foo
>
> and
>
> compctl -Tx 'w[0,foo]' ...
>
> ?? Aside from the obvious fact that you can use multiple `compctl ...`
> commands but only one `compctl -Tx ...`.
>
> Take a look at this:
>
> ...
>
> The above turns every compctl that doesn't use -x (because -x completions
> can't be nested) into a single huge compctl -T. (It could probably be
> cleaned up a lot, especially the `stuff' loop for unfolding compctls that
> happen to have embedded newlines e.g. in -k '(...)' lists.)
>
> With some finagling, it ought to be possible to rewrite all the compctls
> that use -x in a similar manner, eventually reducing the entire collection
> of compctls (except for -C and -D) to one `compctl -T`.
>
> Now you may be wondering, what's the point of all this? Well, at first it
> was just a desire to have something like compctl -T but that kicked in only
> after everything else failed. (You can almost get this with -D, but only
> for commands that don't already have some other completion.)
Hm, using flags before a `-x' or `+' with no flags following it
(continue with default completion) aren't enough? Could I get an
example, please?
> Beyond that,
> though, it suggests that there may be a lot of redundant functionality in
> the completion code, which could without much effort be folded together.
>
Not that much, only the following lines could be removed:
else if (linredir ||
!(cmd &&
(((ccp = (Compctlp) compctltab->getnode(compctltab, cmd)) &&
(compc = ret = ccp->cc)) ||
((s = dupstring(cmd)) && remlpaths(&s) &&
(ccp = (Compctlp) compctltab->getnode(compctltab, s)) &&
(compc = ret = ccp->cc)))))
And doing it that way should be faster than the all in one `-T' version.
But I admit that I didn't think of using `-T' with `w[0,...]'...
> Also, if you convert all your compctls to one big -T like that, then you
> can replace 'w[0,string]' with 'W[0,pattern]' and get an effect that a few
> persistent zsh-users have been requesting for some years: pattern matching
> on the command name when defining a completion.
>
Huh? That wouldn't be that difficult to implement (I think) and I
don't remember a request for it...
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1997-09-29 6:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-09-29 6:29 Sven Wischnowsky [this message]
1997-09-30 4:57 ` Bart Schaefer
1997-09-30 6:44 Sven Wischnowsky
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=9709290629.AA08437@gamma.informatik.hu-berlin.de \
--to=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).