From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: zsh-users@zsh.org
Subject: Re: Autocorrect for commands with a hyphen (dash) in the name
Date: Tue, 19 May 2020 00:52:02 +0000 [thread overview]
Message-ID: <ab8b7655-83e8-45b2-889f-043314faea62@www.fastmail.com> (raw)
In-Reply-To: <CAH+w=7bKpm7GO2ZhbA5Apr0sBDz5=kmX1=WK2X0nTcWxpkHPPQ@mail.gmail.com>
Bart Schaefer wrote on Tue, 19 May 2020 00:38 +00:00:
> On Mon, May 18, 2020 at 5:16 PM Seth Tisue <seth@tisue.net> wrote:
> >
> > ...doesn't work, in either zsh 5.7 or 5.8:
> > [...]
> > but the same isn't true for underscores:
> > [...]
> > seems like a bug?
>
> 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.
>
> 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 «isset(CORRECT)» codepath, *s is metafied.
The zle callsite passes an unmetafied string, and invoking the spell-word
widget correctly corrects a word that isset(CORRECT) does not correct.
Seth, as a workaround you can use the spell-word widget.
next prev parent reply other threads:[~2020-05-19 0:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 0:15 Seth Tisue
2020-05-19 0:38 ` Bart Schaefer
2020-05-19 0:52 ` Daniel Shahaf [this message]
2020-05-19 21:25 ` Bart Schaefer
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=ab8b7655-83e8-45b2-889f-043314faea62@www.fastmail.com \
--to=d.s@daniel.shahaf.name \
--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).