From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29256 invoked by alias); 21 Oct 2010 22:19:19 -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: 15466 Received: (qmail 4083 invoked from network); 21 Oct 2010 22:19:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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,KHOP_SC_TOP_CIDR8,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.213.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=SThDa3Uh3TfUD7NV2Gi9fJfow386c1zXDS7beZANpkI=; b=p18gwrBj/nYwlNJgUYohpMiXQwFwbk4DQankPd+fzcz2BKr1mQQu3+mPUq72kh9osa 6YuHgrdKkI2QKfbX4vQOm3MMa2JM+XN0zhqlIe4/AcbYdoaQ39hSH9fGz/G8GID6tuci iCZs7xdUUZKVXBC6O6gZYwxvGFUJW8tKnQlu4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=IOk2Qy5Mm5pF5LWaXTBk06FTl6D+CMObEv07J+Ivnb3pV1D4r8C4phIPA+CJ8LzMvh 28+tYXJa+eVws/9pHN72qUxPzG3wLpUx51FblwHg2CFnlxJiAa3CFe0Ui0RYlqqul6nk tsppwyFN1JN0LZMXMqmUSep3tM1OOXaO5aNP4= Date: Thu, 21 Oct 2010 20:19:07 -0200 From: Silas Silva To: Peter Stephenson Cc: zsh-users@zsh.org Subject: Re: Completion for man (_man) patch to support -M Message-ID: <20101021221903.GA660@hope.tifa.renegado> References: <20101021151504.GA24694@bsoares.omnisys.int.com.br> <20101021202912.6e26ce87@pws-pc.ntlworld.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101021202912.6e26ce87@pws-pc.ntlworld.com> User-Agent: Mutt/1.4.2.3i On Thu, Oct 21, 2010 at 08:29:12PM +0100, Peter Stephenson wrote: > On Thu, 21 Oct 2010 13:15:14 -0200 > Silas Silva wrote: > > I was studying the completion system and, since I would like to add > > support for -M for the _man completion, I've done it. Dirty and ugly > > patch is attached. > > Not sure how widespread support for that argument is, certainly man is > historically rather different on different systems, but _man already > doesn't look much like other completion functions, and the intention > here is obvious enough, so I've committed it. Yeah... I tested it under NetBSD and GNU/Linux. It might work under other BSDs as well, but I don't know about other Unices. > > I'm just not sure if it is the better way to do it. opt holds the > > option passed to the -M flag, but (( $words[(I)-M]+1 )) looks ugly? > > Well, apart from the obvious use of a variable (and omitting the > parentheses), > > integer ind=$words[(I)-M] > if (( ind )); then > local opt > opt=$words[ind+1] > _manpath=($_manpath $opt) > fi > > I don't see a major improvement. (I'll commit this improvement on top.) Yeah, having the obvious use of a variable is a good practice. Thanks for the lesson and for the commit. :-) -- Silas Silva