zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Oliver Kiddle <opk@zsh.org>, Zsh Users <zsh-users@zsh.org>
Subject: Re: Questions about completion matchers
Date: Sat, 9 Oct 2021 15:39:58 -0700	[thread overview]
Message-ID: <CAH+w=7aAybU5wRzp2vQ8g_-G=5SRP4593QCWpc8EqGnwt5+8HQ@mail.gmail.com> (raw)
In-Reply-To: <CAHLkEDumxFh=7bLx0geSoL3K-OF9LF447FEzujp_QX1MZ33SMg@mail.gmail.com>

On Sat, Oct 9, 2021 at 3:12 PM Marlon Richert <marlon.richert@gmail.com> wrote:
>
> On Sat, Oct 9, 2021 at 7:23 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> >
> > *             l:|$lpat=$tpat -> [[ $trial = *${~lpat}* ]] &&
> > ${word/#$~lpat/$~tpat}
>
> Perhaps I'm mistaken, but aren't you mixing up $lpat and $lanchor
> here?

Well, sort of, yes.  See Oliver's more recent message.  A better
description of what's happening is that the matcher transforms the
word from the command line into a pattern, and then that pattern is
compared to every one of the trial candidates, and then pieces of the
trial candidates are extracted and merged with the word from the
command line to generate the list of possible replacements for that
word.  It's never as simple as a string substitution on the word
itself taken directly from the patterns in the matcher.

> How about changing the docs to just literally state the transformation
> that each matcher applies?

Because it's not a literal transformation.  Matchers don't transform,
they create a comparison between the command line and the compadd
strings and define which parts of the command line can be replaced by
what parts of the compadd strings when that comparison finds a match.


  reply	other threads:[~2021-10-09 22:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21  9:23 Marlon Richert
2021-09-22 23:25 ` Bart Schaefer
2021-09-26 13:09 ` Oliver Kiddle
2021-10-08 22:38   ` Marlon Richert
2021-10-09 16:23     ` Bart Schaefer
2021-10-09 22:12       ` Marlon Richert
2021-10-09 22:39         ` Bart Schaefer [this message]
2021-10-10 11:17           ` Marlon Richert
2021-10-09 21:59     ` Oliver Kiddle
2021-10-10 12:05       ` Marlon Richert
2021-10-10 20:14         ` 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=7aAybU5wRzp2vQ8g_-G=5SRP4593QCWpc8EqGnwt5+8HQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=marlon.richert@gmail.com \
    --cc=opk@zsh.org \
    --cc=zsh-users@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).