zsh-users
 help / color / mirror / code / Atom feed
From: Silas Silva <silasdb@gmail.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-users@zsh.org
Subject: Re: Completion for man (_man) patch to support -M
Date: Thu, 21 Oct 2010 20:19:07 -0200	[thread overview]
Message-ID: <20101021221903.GA660@hope.tifa.renegado> (raw)
In-Reply-To: <20101021202912.6e26ce87@pws-pc.ntlworld.com>

On Thu, Oct 21, 2010 at 08:29:12PM +0100, Peter Stephenson wrote:
> On Thu, 21 Oct 2010 13:15:14 -0200
> Silas Silva <silasdb@gmail.com> 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


  reply	other threads:[~2010-10-21 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 15:15 Silas Silva
2010-10-21 19:29 ` Peter Stephenson
2010-10-21 22:19   ` Silas Silva [this message]
2010-10-22 14:11   ` Greg Klanderman

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=20101021221903.GA660@hope.tifa.renegado \
    --to=silasdb@gmail.com \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@zsh.org \
    /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).