zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
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	[thread overview]
Message-ID: <CAH+w=7bksUsvS6ixQ-zkCeYYf9+mrE4qz7CuVKW8CGuv=MAjOw@mail.gmail.com> (raw)
In-Reply-To: <CAHLkEDt+5xiu62fLb2Gp9gQOh9Q_o8+-He64fooMMxPceon4vA@mail.gmail.com>

On Sun, Mar 28, 2021 at 9:34 AM Marlon Richert <marlon.richert@gmail.com> 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:


  parent reply	other threads:[~2021-03-28 17:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 16:33 Marlon Richert
2021-03-28 17:10 ` Mikael Magnusson
2021-03-28 17:27   ` Marlon Richert
2021-03-28 17:46 ` Bart Schaefer [this message]
2021-03-28 18:06   ` Marlon Richert
2021-03-28 20:51     ` Bart Schaefer
2021-03-28 21:42 ` Oliver Kiddle
2021-03-29  1:22   ` Bart Schaefer
2021-03-31  6:29   ` Marlon Richert
2021-03-31  9:25     ` Oliver Kiddle
2021-03-31 10:07       ` Marlon Richert
2021-03-31 23:20     ` Daniel Shahaf
2021-04-01  5:11       ` Marlon Richert
2021-04-01 17:08         ` Daniel Shahaf
2021-04-02 12:58           ` Marlon Richert
2021-04-03  3:12           ` Daniel Shahaf
2021-04-05 10:26             ` Marlon Richert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7bksUsvS6ixQ-zkCeYYf9+mrE4qz7CuVKW8CGuv=MAjOw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=marlon.richert@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).