From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@math.gatech.edu
Subject: Re: Latest patched development version
Date: Thu, 21 Jan 1999 10:42:39 +0100 (MET) [thread overview]
Message-ID: <199901210942.KAA18505@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Sun, 10 Jan 1999 18:38:28 -0800
Bart Schaefer wrote:
> Is there any reason that -tc simply can't be implicit? That is, why not
> always continue with the next suitable completion, leaving -t+ -t- and -tx
> to change what "next suitable" means? And then perhaps throw in something
> like -tn to mean "no, DON'T continue."
>
> Seems to me it's more often the case that you want to go on trying other
> possible completions rather than giving up. The default should be what
> the most common case is.
(Even without getting more opinions on this I used some spare time to
build the patch below...)
After re-reading Bart's message I started to like the idea. So, the
patch below makes `-t' behave like Bart described above. The fact that
the patch doesn't need to fiddle with zle_tricky.c shows that this
isn't that big a change in the concept of `-t'.
With this patch `-t' accepts only one character which says where to
continue to produce matches. Without any `-t' the next matching
compctl is used, since (as Bart already said) multiple matching
compctls weren't possible before (except for `-T') this shouldn't
introduce too much incompatibility. This also means that you don't
need `-tc' in `-T' or pattern compctls. On the other side, if you have
a case where you don't want normal completion to be used, you should
add a `-tn' (so it's only a slight shift in incompatibilities to a
hopefully less common case).
Especially those who use `compctl -Tx 's[~]' -k friend ...' or
something like that to avoid the normal user-name generation should
put `-tn' in there or otherwise this will become pretty useless.
Any comments?
Bye
Sven
diff -c os/Zle/compctl.c Src/Zle/compctl.c
*** os/Zle/compctl.c Thu Jan 21 09:12:18 1999
--- Src/Zle/compctl.c Thu Jan 21 10:12:04 1999
***************
*** 400,405 ****
--- 400,406 ----
}
memset((void *)&cct, 0, sizeof(cct));
+ cct.mask2 = CC_CCCONT;
/* Loop through the flags until we have no more: *
* those with arguments are not properly allocated yet, *
***************
*** 516,541 ****
p = *++argv;
*argv = "" - 1;
}
! while (*p) {
! switch (*p) {
! case '+':
! cct.mask2 |= CC_XORCONT;
! break;
! case 'c':
! cct.mask2 |= CC_CCCONT;
! break;
! case '-':
! cct.mask2 |= CC_PATCONT;
! break;
! case 'x':
! cct.mask2 |= CC_DEFCONT;
! break;
! default:
! zwarnnam(name, "invalid retry specification character `%c'",
! NULL, *p);
! return 1;
! }
! p++;
}
}
break;
--- 517,544 ----
p = *++argv;
*argv = "" - 1;
}
! switch (*p) {
! case '+':
! cct.mask2 = CC_XORCONT;
! break;
! case 'n':
! cct.mask2 = 0;
! break;
! case '-':
! cct.mask2 = CC_PATCONT;
! break;
! case 'x':
! cct.mask2 = CC_DEFCONT;
! break;
! default:
! zwarnnam(name, "invalid retry specification character `%c'",
! NULL, *p);
! return 1;
! }
! if (p[1]) {
! zwarnnam(name, "too many retry specification characters: `%s'",
! p + 1, 0);
! return 1;
}
}
break;
***************
*** 835,840 ****
--- 838,844 ----
cc->xor = (Compctl) zcalloc(sizeof(*cc));
cc = cc->xor;
memset((void *)&cct, 0, sizeof(cct));
+ cct.mask2 = CC_CCCONT;
}
}
}
***************
*** 1362,1378 ****
t >>= 1;
}
}
! if (flags2 & (CC_XORCONT | CC_CCCONT | CC_PATCONT | CC_DEFCONT)) {
printf(" -t");
if (flags2 & CC_XORCONT)
putchar('+');
- if (flags2 & CC_CCCONT)
- putchar('c');
if (flags2 & CC_PATCONT)
putchar('-');
if (flags2 & CC_DEFCONT)
putchar('x');
! }
/* now flags with arguments */
printif(cc->mstr, 'M');
if (flags2 & CC_NOSORT)
--- 1366,1381 ----
t >>= 1;
}
}
! if (flags2 & (CC_XORCONT | CC_PATCONT | CC_DEFCONT)) {
printf(" -t");
if (flags2 & CC_XORCONT)
putchar('+');
if (flags2 & CC_PATCONT)
putchar('-');
if (flags2 & CC_DEFCONT)
putchar('x');
! } else if (!(flags2 & CC_CCCONT))
! printf(" -tn");
/* now flags with arguments */
printif(cc->mstr, 'M');
if (flags2 & CC_NOSORT)
diff -c od/Zsh/compctl.yo Doc/Zsh/compctl.yo
*** od/Zsh/compctl.yo Thu Jan 21 09:29:30 1999
--- Doc/Zsh/compctl.yo Thu Jan 21 10:25:57 1999
***************
*** 85,91 ****
to the user database is too slow and/or it contains too many users (so
that completion after `tt(~)' is too slow to be usable), you can use
! nofill(tt(compctl -Tx 'C[0,*/*]' -f - 's[~]' -k friends -S/))
to complete the strings in the array tt(friends) after a `tt(~)'.
The first argument is necessary so that this form of ~-completion is
--- 85,91 ----
to the user database is too slow and/or it contains too many users (so
that completion after `tt(~)' is too slow to be usable), you can use
! nofill(tt(compctl -Tx 'C[0,*/*]' -f - 's[~]' -k friends -S/ -tn))
to complete the strings in the array tt(friends) after a `tt(~)'.
The first argument is necessary so that this form of ~-completion is
***************
*** 432,447 ****
with the same name and the matches in those groups will not be mixed.
)
item(tt(-t) var(continue))(
! The var(continue)-string contains a set of characters that specify if
! and when completion should continue to produce matches where it normally
! would not do that. The character tt(c) means that completion continues
! with the next suitable compctl (i.e. if you don't specify this in a
! tt(compctl -T), compctls for commands are never used). The character
! tt(PLUS()) is used to continue with the matches for the next alternative
! completion (see below). The characters tt(-) and tt(x) may be used in
! sub-lists for extended completion (see below). They will make the completion
! code use the flag list after the next tt(-) (if the corresponding pattern
! matches) and the default flag list (those before the tt(-x)), respectively.
)
item(tt(-M) var(match-spec))(
This defines additional matching control specifications that should be used
--- 432,449 ----
with the same name and the matches in those groups will not be mixed.
)
item(tt(-t) var(continue))(
! The var(continue)-string contains a character that specifies which set
! of completion flags should be used next. Normally those of the next
! matching compctl are used, i.e. pattern compctls and normal compctls
! after tt(-T) and after a pattern compctl. If var(continue) is the
! character tt(PLUS()) the flags for the next alternative completion
! (see below) are used. The characters tt(-) and tt(x) can be used in
! sub-lists for extended completion (see below). They will make the
! completion code use the flag list after the next tt(-) (if the
! corresponding pattern matches) and the default flag list (those before
! the tt(-x)), respectively. if var(continue) is the character tt(n) no
! other flag lists are used, i.e. the generation of matches stops
! immediately.
)
item(tt(-M) var(match-spec))(
This defines additional matching control specifications that should be used
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-01-21 9:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-01-21 9:42 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-01-11 10:05 Sven Wischnowsky
1999-01-12 17:34 ` Bart Schaefer
1998-12-15 14:57 Sven Wischnowsky
1999-01-11 2:38 ` Bart Schaefer
1998-12-15 11:59 Sven Wischnowsky
1998-12-15 13:05 ` Peter Stephenson
1998-12-15 14:03 ` Bruce Stephens
1998-12-15 14:44 ` Bruce Stephens
1998-12-14 13:57 Peter Stephenson
1998-12-14 17:05 ` Bruce Stephens
1998-12-14 17:27 ` Peter Stephenson
1998-12-14 17:31 ` Bruce Stephens
1998-12-14 18:54 ` Phil Pennock
1998-12-14 20:13 ` Bart Schaefer
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=199901210942.KAA18505@beta.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).