zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: using the description from _arguments foo:description:->state
Date: Wed, 21 Sep 2011 21:04:01 -0700	[thread overview]
Message-ID: <110921210401.ZM17166@torch.brasslantern.com> (raw)
In-Reply-To: <20002.1316625028@thecus.kiddle.eu>

On Sep 21,  7:10pm, Oliver Kiddle wrote:
}
} So given that you "don't think adding -d buys much" and there is the
} compatibility issue I mentioned, what would you suggest?  A local in
} _main_complete would fall down in the case of a function using states
} calling another function that also uses states but which doesn't declare
} state_descr local.

That'd be a bug in one or the other of those functions, would it not?
Declaring state_descr in _main_complete is just to keep it from leaking
out to the top level, not to make it possible for functions that need
it to avoid declaring it.  There's a huge list of other variables that
already "fall down" in this way; one more isn't going to kill us.  (I
don't *like* the necessity of that huge list, but there it is.)

} Perhaps _arguments/_values could leave state_descr alone where
} the description is blank or consists of just a space.

Unfortunately both _arguments and _values need to erase the existing
value of the state-related variables before they know whether there
are any states or descriptions to assign.  The right way to do this
probably would have been to pass the names of the variables to set
rather than rely entirely on scoping, but [unless someone wants to
undertake a major drudgework project to update the whole Completion
tree] it's too late to deal with that now.

E.g., _arguments has (after my not - committed patch):

  context=()
  state=()
  state_descr=()

These could all become

  (( $+context )) && context=()
  (( $+state )) && state=()
  (( $+state_descr )) && state_descr=()

and similarly for the place that useful values are assigned to each of
them (there's only one such place), but that still doesn't help for a
recursive call to _arguments or for a call to _values from _arguments.


      reply	other threads:[~2011-09-22  4:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-11 15:04 Mikael Magnusson
2011-09-11 18:10 ` Bart Schaefer
2011-09-20 15:16   ` Mikael Magnusson
2011-09-21 11:39     ` Oliver Kiddle
2011-09-21 15:50       ` Bart Schaefer
2011-09-21 17:10         ` Oliver Kiddle
2011-09-22  4:04           ` Bart Schaefer [this message]

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=110921210401.ZM17166@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).