Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: curtag (Re: can't run _email-mutt)



Bart wrote:

> I'm not sure how $curtag would apply in this case, because it's not set
> until _requested or _wanted calls _all_labels from inside the _tags loop?
> Or are we talking about nested _tags loops here, which is already a bit
> of a sticky wicket?

It'd need to use ${curtag:-email-addresses} to cover cases where a tag
isn't supplied by the calling function. I just think that the tag is the
right place for it. We could use the argument field as you suggested.
It's not really what that's meant for and we'd lose any existing value
in the argument field. That means you can't, for example, spot when you
have the -c flag to mutt. But the argument field is probably better than
nothing.

> It's entirely possible that there's some subtlety I'm missing.
> 
> On a more general note, though, it would appear that $curtag is rather
> under-utilized.  By a quick grep I count about 15 functions that use both
> _tags and zstyle without reference to $curtag.  _email_addresses is the
> only one that seems to use it as it was intended.

It really depends whether it is potentially useful to have different
settings for different tags or tag labels in each situation. It is
under-utilized, however.

Searching for uses of _tags and zstyle isn't necessarily helpful because
different settings for tag labels could also be useful. For example in
_pids, we could put _call_program within a tag loop. I've not tested
this but it should then be possible to do the following:

zstyle ':completion:*:processes' tag-order \
    'processes:-tty' 'processes:-mine' 'processes:-all'
zstyle ':completion:*:processes-tty' command ps
zstyle ':completion:*:processes-mine' command "ps -u $EUID"
zstyle ':completion:*:processes-all' command 'ps -e'

Then, when completing process IDs, _next_tags can be used to control
which processes are listed.

Oliver



This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



Messages sorted by: Reverse Date, Date, Thread, Author