From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25558 invoked from network); 9 Oct 2021 22:00:12 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Oct 2021 22:00:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date: Content-Transfer-Encoding:Content-ID:Content-Type:MIME-Version:Subject:To: References:From:In-reply-to:cc:Reply-To:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=H8oBKemXqbhADJcdGHCWoOHelOySPxE6wgKAcaIk7ts=; b=c57ml4MevPS4FnedACZt1Nxupo kd+qIICcst7uATvNv3IL9BxrQFlWRLgZozSkOplDN4TSnZYnzpaZPKVbnsJbSX603IPWidk3O+v9Q lEKpz8x2rqNfyHaSXvCtgFLoHbI3FK82IFajgVQ1ag0/IEJO6UUPlAdnkmB2Umt2vGiVM2vRQCcau z2ngNYBZBuIbqpZWt1xLCAJqa3Z7oosQAHx1quVrwqNbhEXEWAyXsiwkn1WHNYH6psaeQbm2+xI3d f6w7sb4i3V/7Fh0YojQx1gUCClgrMy8jrBuKndZvbIGdqfVDW1cutAv8uyimAPK1JEl57/wQFUcwu Z8s4gbaw==; Received: from authenticated user by zero.zsh.org with local id 1mZKO2-0003Rh-Al; Sat, 09 Oct 2021 22:00:10 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mZKNI-0002ho-6v; Sat, 09 Oct 2021 21:59:24 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1mZKNC-0003JX-KE; Sat, 09 Oct 2021 23:59:19 +0200 cc: Zsh Users In-reply-to: From: Oliver Kiddle References: <20296-1632661753.678317@ipjb.25sX.Whnd> To: Marlon Richert Subject: Re: Questions about completion matchers MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <12741.1633816758.1@hydra> Content-Transfer-Encoding: 8bit Date: Sat, 09 Oct 2021 23:59:18 +0200 Message-ID: <12742-1633816758.622067@mB95.qJqC.4--_> X-Seq: 27223 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Marlon Richert wrote: > Thanks, Oliver, for your long and thoughtful response. I'm afraid I don't quite > understand all of it, though. Let me try to explain how I've understood things, > but in a way that I find easier to process, and do please correct me where I'm > wrong. > > The way I've understood it, is that, if $word contains the command line string > for which completion is attempted, then each matcher should transform $word as > follows: That's not what the implementation does in any real sense so I'm not sure how helpful it is to reframe the regular expressions I gave in zsh syntax. But the effect is along those basic lines if you view the "transformed" $word as being a pattern that is matched against each of the candidate matches in turn to decide which to present as matches. I find it helpful as a brief reference but if it doesn't make sense to you, ignore it. > However, this leaves several transformations identical, which makes me believe > I've misunderstood something. > > What did I miss? The difference between b: and l: with an empty anchor (or e/r) is not encapsulated by my regular expressions. They only differ in how strict the anchoring to the start of the match is where another matching control allowed extra characters to be inserted at the beginning. The example given when this was added was zsh option completion where underscores are ignored and a prefix of NO is allowed. I took a look at the source code and dug out original -workers posts and it does seem that the intention for the two anchor || forms was as I thought. Even as designed I don't think either is ideal for camel case - the l: form excludes characters from the wrong anchor for that. The matching code looks a lot like regular expression matching with a back tracking algorithm. Oliver