zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: possibly useful zsh_directory_name implementation
Date: Fri, 11 Mar 2011 18:24:07 +0000	[thread overview]
Message-ID: <20110311182407.680d6afd@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <AANLkTikvpOu6KZADcxBEPiiGPhpNMP6shVFBd0bocXaJ@mail.gmail.com>

On Fri, 11 Mar 2011 18:09:57 +0100
Mikael Magnusson <mikachu@gmail.com> wrote:
> Can you really just call a bunch of completions in series and get a
> useful result? The documentation still seems to imply running will
> stop as soon as one hook returns 0 status.

Completion of a set of possibilities is a completely different operation
from turning one, unique, name into one, unique, directory.  You don't
know the first function to be called is the one that will produce the
completion you want.  If the user typed "p", does the user want
"pigbreeder-ahab" from zsh_directory_name_farmers, or "proj:monty" from
zsh_directory_name_projects?  The order of the functions doesn't tell
you.

> More importantly, shouldn't you only run zsh_directory_name if that
> function exists? As it is now, it will be run even if only the array
> is defined.

Yes, I'll fix that.

> Also, why the mix of -n $foo and ${+foo}?

Your $foo is looking for the presence of a function.  I think
${+functions[...]} does work, it just happened not to be done that way
and I didn't change it.  Your ${+foo} is looking for a variable being
set; that's not what -n $foo does, and although -n $foo does the right
thing as far as completion is concerned, testing the presense of the
variable is the right thing to avoid triggering the error message which
should only pop up if there is no defined mechanism for expanding ~[...].

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


  reply	other threads:[~2011-03-11 18:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11  1:06 Mikael Magnusson
2011-03-11  1:15 ` Mikael Magnusson
2011-03-11 10:44 ` Peter Stephenson
2011-03-11 12:06   ` Mikael Magnusson
2011-03-11 12:17     ` Peter Stephenson
2011-03-11 12:32       ` Mikael Magnusson
2011-03-11 16:25   ` Peter Stephenson
2011-03-11 16:33     ` Peter Stephenson
2011-03-11 17:09       ` Mikael Magnusson
2011-03-11 18:24         ` Peter Stephenson [this message]
2011-03-11 17:44 ` Jérémie Roquet

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=20110311182407.680d6afd@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.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).