zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Cc: 246305-submitter@bugs.debian.org
Subject: Re: Bug#246305: zsh: completion for sudo doesn't add commands under root's path
Date: Sat, 1 May 2004 05:25:46 +0000	[thread overview]
Message-ID: <1040501052546.ZM1893@candle.brasslantern.com> (raw)
In-Reply-To: <20040501050229.GA11064@scowler.net>

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

<Nodding.>

} 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.


  reply	other threads:[~2004-05-01  5:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <877jw0gzp3.wl@broken.int.wedontsleep.org>
2004-04-28 13:04 ` Clint Adams
2004-04-28 16:02   ` Bart Schaefer
2004-04-30 12:27     ` Clint Adams
2004-04-30 13:21       ` Oliver Kiddle
2004-04-30 15:39         ` Clint Adams
2004-04-30 16:25           ` Bart Schaefer
2004-05-01  5:02             ` Clint Adams
2004-05-01  5:25               ` Bart Schaefer [this message]
2004-05-01  5:42                 ` Clint Adams
2004-05-01 17:44                   ` [OT] Mail problems (was Re: Bug#246305 ...) Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1040501052546.ZM1893@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=246305-submitter@bugs.debian.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).