From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19137 invoked from network); 7 Oct 2006 12:02:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.6 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Oct 2006 12:02:39 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 57116 invoked from network); 7 Oct 2006 12:02:32 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Oct 2006 12:02:32 -0000 Received: (qmail 27892 invoked by alias); 7 Oct 2006 12:02:22 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10808 Received: (qmail 27882 invoked from network); 7 Oct 2006 12:02:21 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 7 Oct 2006 12:02:21 -0000 Received: (qmail 55716 invoked from network); 7 Oct 2006 12:02:21 -0000 Received: from mtaout02-winn.ispmail.ntl.com (81.103.221.48) by a.mx.sunsite.dk with SMTP; 7 Oct 2006 12:02:20 -0000 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20061007120219.HUUS27023.mtaout02-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Sat, 7 Oct 2006 13:02:19 +0100 Received: from pwslaptop.csr.com ([82.6.97.160]) by aamtaout03-winn.ispmail.ntl.com with ESMTP id <20061007120218.DKQV11710.aamtaout03-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Sat, 7 Oct 2006 13:02:18 +0100 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.7/8.13.7) with ESMTP id k97C2BbC003441; Sat, 7 Oct 2006 13:02:11 +0100 Message-Id: <200610071202.k97C2BbC003441@pwslaptop.csr.com> From: Peter Stephenson To: zsh-users@sunsite.dk (Zsh users list), pws@pwslaptop.csr.com Subject: Re: Move command line options to start of line In-Reply-To: Message from Bart Schaefer of "Fri, 06 Oct 2006 19:55:00 PDT." <061006195500.ZM29412@torch.brasslantern.com> Date: Sat, 07 Oct 2006 13:02:11 +0100 Bart Schaefer wrote: > On Oct 6, 4:07pm, Peter Stephenson wrote: > } > } # This moves an option, possibly with arguments, from before the > } # cursor to immediately after the command word. > > Nice, but not precisely what David Korn had in mind. Given > > zsh% ls -s file1 file2 -l > > the result of the command should be > > zsh% ls -s -l file1 file2 > > and not > > zsh% ls -l -s file1 file2 Why? The option order doesn't usually matter for separate standalone options, and if the order does matter, the function isn't going to be able to guess which way round things have to be anyway. I quite deliberately did it the way I did because of options taking arguments. Consider (example contrived on the spur of the moment, but not wholly unrealistic): su -c 'rm -f .zshrc' username -l Your way, this becomes su -c -l 'rm -f .zshrc' username which is wrong. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/