Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Completion: audit 'compset -P' calls to use shortest match where applicable, plus random drive-by tweaks.
- X-seq: zsh-workers 39489
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Completion: audit 'compset -P' calls to use shortest match where applicable, plus random drive-by tweaks.
- Date: Thu, 29 Sep 2016 06:51:54 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=VTPYw7c2QnO3GY9Jmz2X4wHdt1M=; b=p8Yqby qUg5zfbEMYXC/Plrhxm4241bTZd90jmcKPmq3SMZSmVfbwXrU2JzkHXaQGlBodwC mdbJhgVajUpLzDguEbBF70pCJBoK3BmHX3sGU1hLFUFTuMW34hkcr8dx3APxTwTV BIAAiWINcFj61S1q+t3wcCFBTlbAg0giRSsFc=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=VTPYw7c2QnO3GY9Jmz2X4wHdt1M=; b=XJu9L it+KIf0HK2XDjVUOexOdY5eVQjvgV+kdm7FCWb3MMYWMZhjLupwWsKNG10EqfQTP G7rhgRx6NxVO9Znp3RzkRbztTN+f27TzlInsthuaqjWt1YmSFD+nJZfyrZz/SAF4 s+GZ6zxkNk3kC84NoLcOsi5Fx1fFaFgjWFfJGc=
- In-reply-to: <160928122817.ZM32377@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1475084797-17029-1-git-send-email-danielsh@fujitsu.shahaf.local2> <160928122817.ZM32377@torch.brasslantern.com>
Bart Schaefer wrote on Wed, Sep 28, 2016 at 12:28:17 -0700:
> On Sep 28, 5:46pm, Daniel Shahaf wrote:
> } I'm not sure what to do about the handling of "_path_files -P foo": that -P
> } option documents its argument as a string but interprets it as a pattern.
> } Should we update the documentation to match the implementation, or vice-versa?
>
> } if (( $#pfx )); then
> } + # ### Is it correct to interpret -P as a (greedy) pattern here?
> } compset -P "$pfx[2]" || pfxsfx=( "$pfx[@]" "$pfxsfx[@]" )
> } fi
>
> I think it would be OK / correct to use ${(b)pfx[2]} there. Presumably if
> $pfx[2] doesn't literally match the filename, we're falling back to the
> pfxsfx assignment to resolve it later.
>
I'll make the change then.
> Here in _cpio:
>
> } - if compset -P '*:'; then
> } - # TODO: doesn't need to be rsh.
>
> The TODO comment may have been meant to indicate there should be a zstyle
> to choose what remote shell program to use? Dumping the comment and
> forcing ssh might not be what was intended, but maybe it's OK, as it's
> consistent with what we do for remote shell pretty much everywhere else.
>
I note that this block is for GNU cpio which has a --rsh-command flag.
Perhaps the correctest thing to do would be to use that. I don't intend
to pursue this, though.
> In _rdesktop:
>
> } redir="${PREFIX%%:*}"
> } - if compset -P '*='; then
> } + if compset -P 1 '*='; then
> } curcontext="${curcontext%:*}:$redir"
> } - compset -P '*='
> } case $redir in
>
> The old code does look suspicious, but does anyone know if it was doing
> two "compset"s intentionally?
The second compset would have been a no-op on all inputs, wouldn't it?
Even its exit code was discarded.
Thanks for the review.
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author