From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 155 invoked from network); 13 Aug 2007 20:08:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Aug 2007 20:08:04 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 75684 invoked from network); 13 Aug 2007 20:07:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Aug 2007 20:07:58 -0000 Received: (qmail 23876 invoked by alias); 13 Aug 2007 20:07:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23755 Received: (qmail 23866 invoked from network); 13 Aug 2007 20:07:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 13 Aug 2007 20:07:53 -0000 Received: (qmail 75408 invoked from network); 13 Aug 2007 20:07:53 -0000 Received: from mtaout02-winn.ispmail.ntl.com (81.103.221.48) by a.mx.sunsite.dk with SMTP; 13 Aug 2007 20:07:46 -0000 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20070813200744.QZZE4.mtaout02-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Mon, 13 Aug 2007 21:07:44 +0100 Received: from pws-pc.ntlworld.com ([81.107.45.67]) by aamtaout03-winn.ispmail.ntl.com with SMTP id <20070813200744.DELZ26699.aamtaout03-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Mon, 13 Aug 2007 21:07:44 +0100 Date: Mon, 13 Aug 2007 21:07:34 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: Unexpected side effect of 'setopt correct' Message-Id: <20070813210734.dbe4b58f.p.w.stephenson@ntlworld.com> In-Reply-To: <17393e3e0708051936m388bf6e4pdca167f03b8dcd5c@mail.gmail.com> References: <17393e3e0708051936m388bf6e4pdca167f03b8dcd5c@mail.gmail.com> X-Mailer: Sylpheed 2.3.1 (GTK+ 2.10.14; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 5 Aug 2007 22:36:38 -0400 "Matt Wozniski" wrote: > I just noticed this effect of 'setopt correct'.. Is this intentional behavior? Ish. > ~> zsh -f > mastermind% setopt correct > mastermind% pid() { > zsh: correct 'pid' to 'pic' [nyae]? % > > > mastermind% function pid() { ^^ (actually you don't want the () in this case) > function> > mastermind% > > Is it intentional that it attempts to correct on a function > definition? Is it intentional that it only attempts to correct one of > the two types of function definition? Something about this behavior > caught me off guard. :) Correction happens as the line is parsed. In the first case, the shell has read as far as "pid", and assumes to begin with it's a command word, hence it applies correction. It needs to do this early on because it has to correct the word before it starts parsing the arguments to it. To change this would require a lot more lookahead, or we'd have to live with side effects like not being able to correct to special shell constructs. In the second case, since we've found the keyword "function", we know the next word isn't expected to be an existing command and we can disable spelling correction immediately, -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/