From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1469 invoked from network); 11 Feb 2002 13:05:12 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Feb 2002 13:05:12 -0000 Received: (qmail 822 invoked by alias); 11 Feb 2002 13:05:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16599 Received: (qmail 778 invoked from network); 11 Feb 2002 13:05:00 -0000 Message-ID: <20020211130457.70106.qmail@web9307.mail.yahoo.com> Date: Mon, 11 Feb 2002 13:04:57 +0000 (GMT) From: =?iso-8859-1?q?Oliver=20Kiddle?= Subject: Re: correction hook To: zsh-workers@sunsite.dk In-Reply-To: <20020211080823.GA9961@dman.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit --- Clint Adams wrote: > Someone complained to me that when he mistyped "make" as "mak", zsh > would spell-correct it to "mawk" instead of "make". I had asked him > for > a proposed algorithm to solve this, but he had none. > > The thought then occurred to me that a hook function might be a bit > more > flexible. With the following patch, one can now do something like > > correctword() { > [[ "$1" == mak ]] && CORRECT_GUESS=make > } I haven't been able to try the patch but how would this work if the CORRECT_ALL option is set and there are corrections to be made to more than one word on the command-line. Perhaps the REPLY array could be used instead of one scalar so that all words can be set. > or potentially something more sophisticated that couldn't be > accomplished as effectively as by alias mak=make. Aliases have served me well for the few common typos like this. I have reservations about this because this simple function probably doesn't go far enough. How might you disable correction for certain words, e.g. the destination to a mv command? I'm not entirely convinced by the correction mechanism because it has to interrupt you with its prompt. With the new completion system I get any typo in a word I completed corrected by _approximate anyway. I'd be more inclined to think about a totally different way of spotting and communicating typos such as using the completion system continually and underlining possible typos. Oliver __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com