From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27846 invoked from network); 1 May 2004 05:26:16 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by ns1.primenet.com.au with SMTP; 1 May 2004 05:26:16 -0000 Received: (qmail 686 invoked from network); 1 May 2004 05:26:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 May 2004 05:26:00 -0000 Received: (qmail 7661 invoked by alias); 1 May 2004 05:25:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19862 Received: (qmail 7646 invoked from network); 1 May 2004 05:25:54 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 1 May 2004 05:25:51 -0000 Received: (qmail 32735 invoked from network); 1 May 2004 05:25:50 -0000 Received: from wbar3.sjo1-4-11-009-147.sjo1.dsl-verizon.net (HELO candle.brasslantern.com) (4.11.9.147) by a.mx.sunsite.dk with SMTP; 1 May 2004 05:25:49 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i415Pk401894; Fri, 30 Apr 2004 22:25:46 -0700 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040501052546.ZM1893@candle.brasslantern.com> Date: Sat, 1 May 2004 05:25:46 +0000 In-Reply-To: <20040501050229.GA11064@scowler.net> Comments: In reply to Clint Adams "Re: Bug#246305: zsh: completion for sudo doesn't add commands under root's path" (May 1, 1:02am) References: <877jw0gzp3.wl@broken.int.wedontsleep.org> <20040428130449.GA3198@scowler.net> <1040428160206.ZM29342@candle.brasslantern.com> <20040430122712.GA2985@scowler.net> <17443.1083331282@trentino.logica.co.uk> <20040430153937.GA4644@scowler.net> <1040430162512.ZM1310@candle.brasslantern.com> <20040501050229.GA11064@scowler.net> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: Bug#246305: zsh: completion for sudo doesn't add commands under root's path Cc: 246305-submitter@bugs.debian.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: ** X-Spam-Status: No, hits=2.8 required=6.0 tests=BAYES_00,RCVD_IN_DYNABLOCK, RCVD_IN_NJABL,RCVD_IN_NJABL_DIALUP,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 2.8 On May 1, 1:02am, Clint Adams wrote: } Subject: Re: Bug#246305: zsh: completion for sudo doesn't add commands und } } This is how to achieve the equivalent effects with the patch at the } bottom } Should I commit? It'd be preferable to avoid declaring "local +h" if you don't need them. If you declare them, then zsh has to save/restore the globals, which has the side effect of causing a rehash, etc. So I'd suggest something like: local -a cmdpath if zstyle -a ":completion:${curcontext}" command-path cmdpath && [[ $#cmdpath -gt 0 ]] then local -a +h path local -A +h commands path=( $cmdpath ) # Resets $commands as a side-effect fi _alternative -O args "$defs[@]" Remember that "local" is function-scoped, not block-scoped, so you don't need { } around anything, nor do the local decls have to appear in the same if-branch as the call to _alternative.