From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3151 invoked by alias); 18 Feb 2014 17:00:59 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18485 Received: (qmail 12972 invoked from network); 18 Feb 2014 17:00:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1392742463; bh=Dox2fcL+1vUigqVK1Ksf9hXtBCLC2JhmIfRiZwaxMzc=; h=Received:Received:Received:DKIM-Signature:X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=pLTJb5mDWAXLOvvoUJvJQ/WdR0y1mVrr/UgN9v9nYoHG+miQYRLrUs2Vrefw7ZXPQAUAQ/pvveLTJztLrhEQ1ELYW1b4z2s5eI3UCUtPQQBFM9juRioa3dTQBoW9hAH5d1yWzFcSJ9jaQ5yUemSnKpjoj8xjHHedMuVa1ZYN0rk= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; b=D5Gxf90QQ8c+xoJVuHErhz+A6B5uCyLrq2SJRxg26SWnum7XjXIO7kat6ge9/mIKIgN/0U0ZRoiEZRrenEorMQOnv21hPcxhVlhtiTK9o/j07v7k/MyK8qXadiDZY6CkXO0uRfnWyI/NjWmMJ1KTgYsaN4K0gKH61cQ8QXocjB8=; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1392742463; bh=Dox2fcL+1vUigqVK1Ksf9hXtBCLC2JhmIfRiZwaxMzc=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=AngiMDeWSe0GXewPq+aJHs+BOodt6phWB7glceuhYf1fJQQrEIMHb2QJLKMxjPaOCSjwhsMhjiRo8R+5rPYUEZ7eMSgxgn9O+39OeDWG7SzFERlUFqpnKeMIprH5d9E1jTUVyOXKc6lRMLA3baJxx5maNWSuKAYuFldK3B6IdiE= X-Yahoo-Newman-Id: 492571.24829.bm@smtp121.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: QBKa_ZoVM1npPGF9P0FtLFM.uOcbu4XIS116GIdEt5IQJGT V0lTs_QfA_6lgb7zjTSdEZ7wijxSleYPYalpCAJeYpKpWKVOERKpl0GtA9gz Hz9P4MgMbG91dXDD0SWvp1ioa6WXefiTxpiGm5ap45roacTwFaDyV86mNFKU czkzENuXz_7Qw4qwJ0lcEwv00kzR0MPNrHT3HkR4NuhO.eBaNDv2JGcmvn0d 4miQNScn84wo3Lc9n78bNgnA9a_Bcly7tzxHm0TfwlYNbKRdQKFvpuy7WZ5N CT_L6CPg.Yes9o.RKYvFTgfqhuK3w1XNgKv2skJR9eJm6_6KRob7JWW0TO6M rjGn7ufuUjMrdGqygfamc.mPBisQK0USeWU1xZ8NAimjlhryBTdlwyFY4qbI SFIo9xSOQVx86ToilAbaNyoGYJEAzNlXC3HjY29KvFMgJ5f.qOZDlqWBK4Xq mf0yGt7UsU76.8mqClgl.azDHEvYvmh8dGhvi8ZuPNjXLBKOxEFlW7cTIUgz yrUiMkcszJ5T0ptiOwc2tVU_vpQ-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- X-Rocket-Received: from kiddle.eu (okiddle@5.146.58.100 with plain [188.125.69.59]) by smtp121.mail.ir2.yahoo.com with SMTP; 18 Feb 2014 16:54:23 +0000 UTC In-reply-to: <20140215044539.GA2070@pug.qqx.org> From: Oliver Kiddle References: <16835.1392415885@thecus.kiddle.eu> <20140215004907.GH10654@pug.qqx.org> <140214183336.ZM10372@torch.brasslantern.com> <20140215044539.GA2070@pug.qqx.org> To: zsh-users@zsh.org Subject: Re: Remove space added by completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18432.1392742458.1@thecus.kiddle.eu> Date: Tue, 18 Feb 2014 17:54:22 +0100 Message-ID: <18441.1392742462@thecus.kiddle.eu> On 14 Feb, Aaron Schrab wrote: > >} I don't know about the original poster, but one place where I often > >} don't want a space after a completion is with git branch names, to make > If there's a way to get these arguments passed through the call to > _alternative in __git_commits, I think it would be an improvement to > change the actual arguments used. How about the following? This just uses zparseopts to get the suffixes and puts them in to each of the alternatives. The trickiest part is quoting. I've also added a compset -S call to handle an existing suffix. Oliver diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a2cbf74..cfdbc4f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5526,10 +5526,13 @@ __git_remote_branch_names_noprefix () { __git_commits () { # TODO: deal with things that __git_heads and __git_tags has in common (i.e., # if both exists, they need to be completed to heads/x and tags/x. + local -a sopts ropt + zparseopts -E -a sopts S: r:=ropt R: q + sopts+=( $ropt:q ) _alternative \ - 'heads::__git_heads' \ - 'commit-tags::__git_commit_tags' \ - 'commit-objects::__git_commit_objects' + "heads::__git_heads $sopts" \ + "commit-tags::__git_commit_tags $sopts" \ + "commit-objects::__git_commit_objects" } (( $+functions[__git_heads] )) || @@ -5595,10 +5598,12 @@ __git_commits2 () { (( $+functions[__git_commit_ranges] )) || __git_commit_ranges () { + local -a suf if compset -P '*..(.|)'; then __git_commits $* else - __git_commits $* -qS .. + compset -S '..*' || suf=( -qS .. -r '.@~ ^:' ) + __git_commits $* $suf fi }