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

Re: Proposal: Let compinit make standard widgets with _generic instead of _main_complete



On Mon, Mar 22, 2021 at 12:17 AM Marlon Richert
<marlon.richert@xxxxxxxxx> wrote:
>
> On Sun, Mar 21, 2021 at 1:53 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > +if [[ "${curcontext:-:::}" == ::: ]] &&
> > +   zstyle -t ":completion:::::" generic-widgets "$WIDGET"
> > +then
> > +    _generic "$@"
> > +    return
> > +fi
>
> This feels like a rather roundabout solution. _generic itself already
> checks whether $curcontext is set and then calls _main_complete. Why
> not just do the straightforward thing, and let the widget call
> _generic directly, which in turn will call _main_complete anyway?

This is really only the first in a few steps of patch that I didn't
want to spend time on if this were rejected out of hand.

The problem with calling _generic at all (right now) is that it messes
with $curcontext in a way that may break other functions that rely on
_main_complete behavior.  If we can invert the call sequence so
_main_complete remains first, then _generic itself can be tweaked so
that it does NOT mung the context in that circumstance, while still
leaving the original semantics of creating a new widget with _generic
unchanged.




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