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 1442 invoked from network); 19 May 2020 00:53:50 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 19 May 2020 00:53:50 -0000 Received: (qmail 28956 invoked by alias); 19 May 2020 00:53:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24857 Received: (qmail 4474 invoked by uid 1010); 19 May 2020 00:53:39 -0000 X-Qmail-Scanner-Diagnostics: from out3-smtp.messagingengine.com 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(66.111.4.27):SA:0(-2.6/5.0):. Processed in 4.934064 secs); 19 May 2020 00:53:39 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddtiedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtgfesth hqredtreerjeenucfhrhhomhepfdffrghnihgvlhcuufhhrghhrghffdcuoegurdhssegu rghnihgvlhdrshhhrghhrghfrdhnrghmvgeqnecuggftrfgrthhtvghrnhepfefhkeefve eileelheeiffdtkedujeelvdfhtdejtdeggedvuefffeelhefhvdfgnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrd hshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-464-g810d66a-fmstable-20200518v1 Mime-Version: 1.0 Message-Id: In-Reply-To: References: Date: Tue, 19 May 2020 00:52:02 +0000 From: "Daniel Shahaf" To: zsh-users@zsh.org Subject: Re: Autocorrect for commands with a hyphen (dash) in the name Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Bart Schaefer wrote on Tue, 19 May 2020 00:38 +00:00: > On Mon, May 18, 2020 at 5:16 PM Seth Tisue wrote: > > > > ...doesn't work, in either zsh 5.7 or 5.8: > > [...] > > but the same isn't true for underscores: > > [...] > > seems like a bug? >=20 > On a quick glance at the code, it appears hyphen is considered to be > "close to" a number, whereas underscore is considered to be "close to"= > a letter. This may have something to do with a long-ago transcription= > of a then-common keyboard layout. >=20 > Autocorrect isn't really a spelling checker, despite everything that's= > said about it. It's a typographical error checker comparing the > command word to something it can look up in the command hash table. > So it'll fail if the hash table isn't filled yet, or if it decides > your input is too "far away" to be a typo. I think there may be more to it than that. spckword() expects its first= argument, *s, to be unmetafied; however, when that function is called from the =C2=ABisset(CORRECT)=C2=BB codepath, *s is metafied. The zle callsite passes an unmetafied string, and invoking the spell-wor= d widget correctly corrects a word that isset(CORRECT) does not correct. Seth, as a workaround you can use the spell-word widget.