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

Re: [PATCH] Make _expand_alias more usable as a completer

On Mon, Jun 21, 2021 at 12:08 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On 6/20/21, Lawrence Velázquez <larryv@xxxxxxx> wrote:
> > On Thu, Jun 3, 2021, at 5:42 PM, Marlon Richert wrote:
> >> On Thu, Jun 3, 2021 at 2:24 AM Oliver Kiddle <opk@xxxxxxx> wrote:
> >>
> >> > I also wonder if this would be better done from within _command_names
> >> > directly but I'm not sure.
> >>
> >> Actually, I feel like it could instead be added to the _expand
> >> completer. Would that be a better idea than what I presented in this
> >> patch?
> >
> > Anyone have answers to Marlon's questions?
> If it helps, I disagree with conflating _expand_alias (expanding
> aliases) and _expand (filename expansion).

_expand already handles a lot more than just "filename expansion"
(which it actually does not handle at all). A quick test going through
all forms of expansion listed at
https://zsh.sourceforge.io/Doc/Release/Expansion.html shows that
_expand currently handles all of the following:
* parameter expansion
* command substitution
* arithmetic expansion
* brace expansion
* filename generation
(but not history expansion, alias expansion, process substitution or
filename expansion).

Since alias expansion is in fact listed at
https://zsh.sourceforge.io/Doc/Release/Expansion.html, I don't think
it would be too weird to add it to the _expand completer.

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