From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26042 invoked by alias); 16 Mar 2017 21:01:45 -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: 22580 Received: (qmail 22728 invoked from network); 16 Mar 2017 21:01:45 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f174.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.174):SA:0(0.5/5.0):. Processed in 0.971538 secs); 16 Mar 2017 21:01:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.174 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=QMkobu7Zlm3ZVcRwRZjOx8riGwrWkT0O93/hSJzfhAg=; b=PG+32Y2gQ1advkGJCrgFPSPUmvjmpN9vYcn9uPrTd6JB7xH0kMjacuosqSZsAj5FrC bmAdff8s5JToSf//bNHjAraa4WeTXqat08Lbn3g/lnObn+bQy5cfrWe28C0BsfHA+Kyk zJmD3o/SXS6LDar1FFfEI71JBkfDYmRRzxIQbx/W4/78G3PxcsY0asdzP2CmBuLsnBOB fudd3KC+mjcvgjXLapafdA0CdaOe0odRaXwklDejh5qHPThL+Nl6UpB6n04+dgGxBwaF 6UdHGN9ZJQ2sJM2WoeVJnre4IaO6PfMtrClCaxr5MabrKC1n05nfhi4yVhN1yt19i/hf TGdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=QMkobu7Zlm3ZVcRwRZjOx8riGwrWkT0O93/hSJzfhAg=; b=nR95ZNODhBTETe97wfvzt1RgU+so4nAYbt1l0wuLlBOKDJ6wCrNKyH2X6LDZfXHnOi mf+0M2AnCIl6zfv1AhEkk/hCE1P3G2xZ1CZEi89wtkplKlx+rWcc97eoxYcqCy4i2ymE dYM+GAFzVcvf36rUtbtVLW/ph3/wtCBor3CesNG2KrsVakOPfcxfPWWjDFleMzb/ZW3W kRslU1at/cabVnw2HaWB3psgcQY1NX/DR9Gf60ibVGfLsu4BSHtPnEbxMj59r6kymSOb PjDTyYVHdmAJ8ExPQNcxDToX3Cs1ucHgM8pIieIROERzIKqbcp2mSgPxVZCz6GuqDWeN wX+g== X-Gm-Message-State: AFeK/H2EKonPpnIF/gge1dUPiO3Q04OYuKyEbgA4VTteJPLC2yvfAsxnkJvMkfe/lZvRVw== X-Received: by 10.176.23.66 with SMTP id k2mr4479504uaf.23.1489698099166; Thu, 16 Mar 2017 14:01:39 -0700 (PDT) From: Bart Schaefer Message-Id: <170316140224.ZM17994@torch.brasslantern.com> Date: Thu, 16 Mar 2017 14:02:24 -0700 In-Reply-To: <6e020492-e5f4-eca7-c4d4-07dc4257a5ce@thequod.de> Comments: In reply to Daniel Hahler "Re: Setup git-stash completion for a function: $line is wrong" (Mar 15, 12:59am) References: <5fe1f6a0-a0d1-9b21-310c-a3bb16aa7d18@thequod.de> <170312152742.ZM16252@torch.brasslantern.com> <6e020492-e5f4-eca7-c4d4-07dc4257a5ce@thequod.de> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Setup git-stash completion for a function: $line is wrong MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 15, 12:59am, Daniel Hahler wrote: } } It did not work initially, but luckily it seems to be just an off-by-one } error when incrementing CURRENT. Indeed, sorry about that. words[1] is being replaced by $@ rather than appended-to, so you have to take one away from the increment. } > There's already (compdef cmd=service) e.g. } > } > compdef gsta=git } } Yes, I am aware of that, and what I mean is more or less something in this } regard, e.g. by making it handle command+arguments. For other readers of this thread: Any input here on whether this is actually a common use case? } maybe a list could be used: } } compdef gsta=(git stash) That would require that 'compdef' be made a keyword, otherwise that's a syntax error. I don't think we're likely to embed compsys that deeply into the shell syntax. We could maybe do what some other compsys functions do: compdef gsta='(git stash)' Not sure what that would require of the lower-level code where the value of the compdef is evaluated. Probably the right way to approach this is to have a completer "_wrapper" which looks up the replacement command via zstyle, fixes up $words etc., and then calls _complete. The potentially tricky part is preventing the replacement from changing the context, i.e. adding syntactic tokens like globbing or pipes, or at least failing gracefully in that event. } I am using it with the following to automatically update a ctags tags file This sounds more like a job for a git hook ... except there isn't one for "stash".