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

Re: PATCH: tag aliases



Bart Schaefer wrote:

> On Mar 22,  1:56pm, Sven Wischnowsky wrote:
> } Subject: PATCH: tag aliases
> }
> } The idea is to let users invent their own tags. This is done with the
> } tag-order style, the syntax is currently:
> } 
> }   zstyle ':completion:...' tag-order 'foo:bar'
> } 
> } Here, `foo' is the tag offered by the completion function and `bar' is 
> } the alias. Completion will then proceed as if only `foo' were given,
> } i.e. the matches for that tag are generated. BUT: instead of using
> } `foo' to look up style, the function will use `bar'.
> 
> I wish there were a better word for this than "alias".  "Label"?

The only thing that keeps me from changing that now is: would that
really be less confusing? I mean, we are talking about tags in quite a 
few places (especially in the Guide). If we use the name label instead 
of tag-alias we would either have to change several places to `tag or
label' or mention this only under the tag-order style and say that
with such a label, the completion system uses the label instead of the 
tag for lookup. Hm. Maybe I'm thinking too much about the way it is
implemented again. There it really just uses the tag alias (or
alias-tag (?)). I.e. the alias becomes the tag for most purposes
(everything but _wanted/_requested).

> ...
> 
> } And finally: Bart and I had this bit of discussion about changing the
> } completer field to always contain the `-<num>' suffix. And we didn't
> } like it. [...] We could make the completer style allow an alias-syntax
> } like the one from tag-order, too.
> } 
> }   zstyle ':completion:*' completer complete ... complete:foo
> } 
> } The first invocation of _complete would use the usual
> } `...:complete:...' in the context name but the second one would use
> } `...:foo:...' in the completer field.
> 
> This would best be combined with the change you posted in 10231 so
> that it became
> 
>     zstyle ':completion:*' completer complete ... complete:-foo
> 
> so the second call to _complete would use "...:complete-foo:...".

Right, hadn't thought about that. Good.

> } I would then first change the style
> } so that one doesn't need to give the leading underscores
> 
> Incidentally,I don't mind having the leading underscores on the
> completer function names in those styles.  It makes it easier to see
> which arguments are tag names and which ones are function names.  Yes,
> there's only really one tag name, but ...

I came to the same comclusion when thinking about it again at the
weekend. Especially because in the docs we have the descriptions for
the functions, giving their full names.

> } Anyway... I'd like to hear your comments, suggestions and so
> } on. Especially about the configuration stuff, but also about the
> } syntax of the tag-order and file-patterns styles, about the names of
> } the two new functions (yes, I didn't even try to make them sensible
> } because I wasn't sure what I was implementing when I started it), and
> } so on...
> 
> The only thing I'd suggest about the names of the functions is that they
> should be less generic; _loop_tags and _try_aliases (or _try_labels if
> that's a better word for the whole concept, since we already have other
> things called aliases that it's possible to complete ...).  Naming is
> especially important when --enable-function-subdirs is not used.

I'll do this once we've decided how to name them...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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