Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why does _main_complete not try the next completer when $_comp_mesg is non-zero?
- X-seq: zsh-workers 48290
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Marlon Richert <marlon.richert@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Why does _main_complete not try the next completer when $_comp_mesg is non-zero?
- Date: Sun, 28 Mar 2021 10:46:49 -0700
- Archived-at: <https://zsh.org/workers/48290>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-03/CAH%2Bw%3D7bksUsvS6ixQ-zkCeYYf9%2BmrE4qz7CuVKW8CGuv%3DMAjOw%40mail.gmail.com>
- In-reply-to: <CAHLkEDt+5xiu62fLb2Gp9gQOh9Q_o8+-He64fooMMxPceon4vA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDt+5xiu62fLb2Gp9gQOh9Q_o8+-He64fooMMxPceon4vA@mail.gmail.com>
On Sun, Mar 28, 2021 at 9:34 AM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> The following line in _main_complete
>
> [[ -n "$_comp_mesg" ]] && break
>
> has the effect that, whenever _message has been called (with only few
> exceptions), the next completer won't be tried, _even when
> $compstate[nmatches] is zero._
This is documented, though not precisely accurately:
... Note that if there
are no matches at the time this function is called,
compstate[insert] is cleared, so additional matches generated later
are not inserted on the command line.
> Why? What is the reason for this?
_message is intended to be called as a last resort when the completion
function believes it is impossible to generate matches.
(FWIW, I think this behavior pre-dates the ability to complete words
from history, which obviously means it's never literally impossible to
generate something.)
> And is there a convenient way to work around this behavior?
What does "convenient" mean here? More convenient than just invoking
a binding for history-complete when you see the message, so that the
_grep completion is bypassed?
You might be able to do something by specifying a different completion
for the tag :completion::complete:grep:argument-1:
Messages sorted by:
Reverse Date,
Date,
Thread,
Author