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

Re: PATCH: tag aliases



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"?

I don't have any strong opinions on the rest of the stuff that Sven's
already implemented (10230, 10231) except to agree about not wanting
any other nested loops introduced into the process.

} 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:...".

} 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 ...

} 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.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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