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=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8098 invoked from network); 23 May 2020 20:31:43 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 23 May 2020 20:31:43 -0000 Received: (qmail 7888 invoked by alias); 23 May 2020 20:31:34 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45904 Received: (qmail 4470 invoked by uid 1010); 23 May 2020 20:31:34 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-10.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25814. spamassassin: 3.4.4. Clear:RC:0(80.0.253.74):SA:0(-2.0/5.0):. Processed in 0.925304 secs); 23 May 2020 20:31:34 -0000 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _smtprelay.virginmedia.com designates 80.0.253.74 as permitted sender) X-Originating-IP: [86.16.88.158] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.3 cv=YvshubQX c=1 sm=1 tr=0 a=MiHCjVqLJ44lE3bxSlffFQ==:117 a=MiHCjVqLJ44lE3bxSlffFQ==:17 a=IkcTkHD0fZMA:10 a=NLZqzBF-AAAA:8 a=q2GGsy2AAAAA:8 a=fp2VJNI5gkr7Q-bkaP4A:9 a=QEXdDO2ut3YA:10 a=wW_WBVUImv98JQXhvVPZ:22 a=z9dJwno5l634igLiVhy-:22 Message-ID: Subject: Re: [PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name From: Peter Stephenson To: zsh-workers@zsh.org Date: Sat, 23 May 2020 21:30:58 +0100 In-Reply-To: References: <22f19bb4707e388629092d2e8673d8294fa8e375.camel@ntlworld.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfHqy4IaLZSkamw9DO/wYM4CoK+UjILZV5+XF9nckkfuBMuLMocSzqk7yC1OylfUhPtuYjAx16Q7Ch2b68t3GGQSmDvqO/DBzXSccS2K3NXL/xfuyroKR 3nyAPM13scz16KvHG/Q08tfpd88HX3cqd11JSYgH58vSGfbftAtrlg48 On Sat, 2020-05-23 at 12:54 -0700, Bart Schaefer wrote: > On Sat, May 23, 2020 at 12:45 PM Peter Stephenson > wrote: > > > > On Sat, 2020-05-23 at 12:33 -0700, Bart Schaefer wrote: > > > [Moving to -workers from -users] > > > > > > On Tue, May 19, 2020 at 2:25 PM Bart Schaefer wrote: > > > > > > > > So, the following? Or should this also have the equivalent of > > > > > > > > if (*w == Tilde || *w == Equals || *w == String) > > > > *x = *w; > > > > > > Any comment on this? > > > > I don't think you need to put back tokens. > > Good point. > > What about the special handling for Tilde et al? That precedes the > spckword() call in zle_tricky.c Yes, I guess you need to skip over those before untokenizing. That matches this line in spckword(): if (*t == Tilde || *t == Equals || *t == String) t++; The next block is then skipping other tokens. I wonder if that would be the right place to put the surgery? E.g. if thereʼs a Dash or anything else we want to be able to treat literally, dupstring at that point within spckword() and replace those? However, thatʼs late enough that itʼs past the point where we check the word isnʼt already found in a hash table --- and presumably we need at least to have the dashes fixed by that point. But still not sure we actually need two separate token-based interventions. pws