From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7877 invoked from network); 10 Nov 2007 14:22:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) 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.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 Nov 2007 14:22:49 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 50048 invoked from network); 10 Nov 2007 14:22:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Nov 2007 14:22:40 -0000 Received: (qmail 17234 invoked by alias); 10 Nov 2007 14:22:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24081 Received: (qmail 17217 invoked from network); 10 Nov 2007 14:22:31 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 10 Nov 2007 14:22:31 -0000 Received: (qmail 49663 invoked from network); 10 Nov 2007 14:22:31 -0000 Received: from mtaout03-winn.ispmail.ntl.com (81.103.221.49) by a.mx.sunsite.dk with SMTP; 10 Nov 2007 14:22:24 -0000 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20071110142218.YEYU26125.mtaout03-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Sat, 10 Nov 2007 14:22:18 +0000 Received: from pws-pc.ntlworld.com ([81.107.45.67]) by aamtaout01-winn.ispmail.ntl.com with SMTP id <20071110142217.YARX219.aamtaout01-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Sat, 10 Nov 2007 14:22:17 +0000 Date: Sat, 10 Nov 2007 14:22:14 +0000 From: Peter Stephenson To: zsh-workers Subject: Re: delete-whole-word-match fails on words starting with -, patch Message-Id: <20071110142214.1c31b981.p.w.stephenson@ntlworld.com> In-Reply-To: <237967ef0711091438p6ff14d62v2013a5a4d6a07b42@mail.gmail.com> References: <200711091706.lA9H6aqd011428@news01.csr.com> <200711091948.lA9JmlJh004347@pws-pc.ntlworld.com> <237967ef0711091438p6ff14d62v2013a5a4d6a07b42@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 Fri, 9 Nov 2007 23:38:55 +0100 "Mikael Magnusson" wrote: > By that, if you mean the problem with words starting with -, i > realized it only happens if you call it as kill-whole-word-match. I should have realised that, but didn't, because I was looking at the wrong test for *kill* (the $LASTWIDGET one, which is in the opposite sense). > +delete-whole-word-match:53> zle copy-region-as-kill '-test ' > > delete-whole-word-match:zle:53: unknown option: test The penny has finally dropped: I was also trying it out with words beginning "--" in a GNUish fashion, which already look like an end of option list marker, so I didn't see this. Yes, your patch is entirely correct and the option handling is for setting the numeric prefix and the widget name locally; these follow the widget name to distinguish them from options to zle instead of to the widget call. Here's a more complete version. I think the various places where "$@" gets passed to widgets in ZLE functions are intended to include options passed, so need to be left alone. I haven't looked at the other problems yet. Index: Doc/Zsh/zle.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v retrieving revision 1.56 diff -u -r1.56 zle.yo --- Doc/Zsh/zle.yo 19 Apr 2007 14:16:23 -0000 1.56 +++ Doc/Zsh/zle.yo 10 Nov 2007 14:19:19 -0000 @@ -554,7 +554,9 @@ active. With the option tt(-w), tt(WIDGET) and related parameters are set to reflect the widget being executed by the tt(zle) call. -Any further arguments will be passed to the widget. If it is a shell +Any further arguments will be passed to the widget; note that as +standard argument handling is performed, any general argument list +should be preceded by tt(-)tt(-). If it is a shell function, these are passed down as positional parameters; for builtin widgets it is up to the widget in question what it does with them. Currently arguments are only handled by the incremental-search commands, Index: Functions/Zle/backward-kill-word-match =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Zle/backward-kill-word-match,v retrieving revision 1.2 diff -u -r1.2 backward-kill-word-match --- Functions/Zle/backward-kill-word-match 19 Apr 2007 14:16:23 -0000 1.2 +++ Functions/Zle/backward-kill-word-match 10 Nov 2007 14:19:19 -0000 @@ -23,7 +23,7 @@ if [[ -n $done || $LASTWIDGET = *kill* ]]; then CUTBUFFER="$word$CUTBUFFER" else - zle copy-region-as-kill "$word" + zle copy-region-as-kill -- "$word" fi LBUFFER=$matched_words[1] else Index: Functions/Zle/delete-whole-word-match =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Zle/delete-whole-word-match,v retrieving revision 1.3 diff -u -r1.3 delete-whole-word-match --- Functions/Zle/delete-whole-word-match 19 Apr 2007 14:16:23 -0000 1.3 +++ Functions/Zle/delete-whole-word-match 10 Nov 2007 14:19:19 -0000 @@ -9,7 +9,7 @@ # saved for future yanking in the normal way. emulate -L zsh -setopt extendedglob +setopt extendedglob xtrace local curcontext=:zle:$WIDGET local -a matched_words @@ -49,7 +49,7 @@ if [[ $LASTWIDGET = *kill* ]]; then CUTBUFFER="$CUTBUFFER$word" else - zle copy-region-as-kill "$word" + zle copy-region-as-kill -- "$word" fi fi BUFFER="${BUFFER[1,pos1]}${BUFFER[pos2,-1]}" Index: Functions/Zle/kill-word-match =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Zle/kill-word-match,v retrieving revision 1.3 diff -u -r1.3 kill-word-match --- Functions/Zle/kill-word-match 19 Apr 2007 14:16:23 -0000 1.3 +++ Functions/Zle/kill-word-match 10 Nov 2007 14:19:19 -0000 @@ -22,7 +22,7 @@ if [[ -n $done || $LASTWIDGET = *kill* ]]; then CUTBUFFER="$CUTBUFFER$word" else - zle copy-region-as-kill $word + zle copy-region-as-kill -- $word fi RBUFFER=${(j..)matched_words[6,7]} else -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/