From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19371 invoked from network); 1 May 2004 05:03:39 -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:03:39 -0000 Received: (qmail 26537 invoked from network); 1 May 2004 05:03:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 May 2004 05:03:16 -0000 Received: (qmail 28183 invoked by alias); 1 May 2004 05:03:09 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19861 Received: (qmail 28173 invoked from network); 1 May 2004 05:03:09 -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:03:06 -0000 Received: (qmail 25889 invoked from network); 1 May 2004 05:02:59 -0000 Received: from acolyte.scowler.net (216.254.112.45) by a.mx.sunsite.dk with SMTP; 1 May 2004 05:02:57 -0000 Received: by acolyte.scowler.net (Postfix, from userid 1000) id D396B70047; Sat, 1 May 2004 01:02:29 -0400 (EDT) Date: Sat, 1 May 2004 01:02:29 -0400 From: Clint Adams To: Bart Schaefer Cc: 246305-submitter@bugs.debian.org, zsh-workers@sunsite.dk Subject: Re: Bug#246305: zsh: completion for sudo doesn't add commands under root's path Message-ID: <20040501050229.GA11064@scowler.net> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1040430162512.ZM1310@candle.brasslantern.com> User-Agent: Mutt/1.5.5.1+cvs20040105i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=6.0 tests=BAYES_00 autolearn=no version=2.63 X-Spam-Hits: -4.9 This is how to achieve the equivalent effects with the patch at the bottom, which could probably use some deuglification/optimization. Should I commit? > zstyle ':completion:*:sudo:*' command-path delete . .. '../*' zstyle -e ':completion:*:sudo:*' command-path 'reply=(${path:#(.|..|../*})' > zstyle ':completion:*:sudo:*' command-path append /usr/local/bin /opt/bin zstyle -e ':completion:*:sudo:*' command-path 'reply=($path /usr/local/bin /opt/bin)' > zstyle ':completion:*:sudo:*' command-path prepend ~/bin /usr/local/bin zstyle -e ':completion:*:sudo:*' command-path 'reply=(~/bin /usr/local/bin $path)' > zstyle ':completion:*:sudo:*' command-path assign /bin /usr/bin /usr/sbin zstyle ':completion:*:sudo:*' command-path /bin /usr/bin /usr/sbin > (This begs the question of what to do if you want to add things at both > the end and the beginning.) zstyle -e ':completion:*:sudo:*' command-path 'reply=(~/bin $path /usr/local/bin /opt/bin)' Though I don't see the significance of path order. Index: Completion/Zsh/Type/_command_names =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_command_names,v retrieving revision 1.6 diff -u -r1.6 _command_names --- Completion/Zsh/Type/_command_names 3 Sep 2003 10:15:35 -0000 1.6 +++ Completion/Zsh/Type/_command_names 1 May 2004 04:57:49 -0000 @@ -33,4 +33,13 @@ args=( "$@" ) +{ +local -a oldpath +oldpath=( $path ) +local -A +h commands +local -a cmdpath +zstyle -a ":completion:${curcontext}" command-path cmdpath +local -a +h path +[[ $#cmdpath -gt 0 ]] && path=( $cmdpath ) || path=( $oldpath ) _alternative -O args "$defs[@]" +}