From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16798 invoked from network); 9 Nov 2007 22:39:13 -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.6 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; 9 Nov 2007 22:39:13 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 47078 invoked from network); 9 Nov 2007 22:39:07 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 9 Nov 2007 22:39:07 -0000 Received: (qmail 28760 invoked by alias); 9 Nov 2007 22:39:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24080 Received: (qmail 28740 invoked from network); 9 Nov 2007 22:39:04 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 9 Nov 2007 22:39:04 -0000 Received: (qmail 46844 invoked from network); 9 Nov 2007 22:39:04 -0000 Received: from nz-out-0506.google.com (64.233.162.235) by a.mx.sunsite.dk with SMTP; 9 Nov 2007 22:38:58 -0000 Received: by nz-out-0506.google.com with SMTP id r28so580941nza for ; Fri, 09 Nov 2007 14:38:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=AVz3mxVAx6s7UbsCa8RS4xvyzdFOgEONkgtTpVrP0Fg=; b=JHdfCzKNOoowd3XLJpkFncHWfxkh1aXVroNqZNCl4C4lWoJ9au4OUiM+dsMaA3i72xcZUFntNRuBey+IMCiJQLkKXZBxb62I67fIbHcnXlk3HSAiayOY3Hzo/QsGq0yjxfKy29eqb8br/ieodRd8LGu0FW3zAWf9CjA2R6FEoz8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=phqx9c3WvU8WF5g0h+xY8keXI941gBJZc3G5VJyGHhPFS79FhAxZRVOumLeehixw8mriEQKHrAfyK44yDwvxFGMz292qm/qxT2j9lqYlfXcFCcpZldKBUYeYuewu7SwdG8ogyvlAQH3xNDx0pl9jl62Ccvjpj/owWz6ykXDMRSg= Received: by 10.142.127.10 with SMTP id z10mr809680wfc.1194647935762; Fri, 09 Nov 2007 14:38:55 -0800 (PST) Received: by 10.142.86.21 with HTTP; Fri, 9 Nov 2007 14:38:55 -0800 (PST) Message-ID: <237967ef0711091438p6ff14d62v2013a5a4d6a07b42@mail.gmail.com> Date: Fri, 9 Nov 2007 23:38:55 +0100 From: "Mikael Magnusson" To: zsh-workers Subject: Re: delete-whole-word-match fails on words starting with -, patch In-Reply-To: <200711091948.lA9JmlJh004347@pws-pc.ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200711091706.lA9H6aqd011428@news01.csr.com> <200711091948.lA9JmlJh004347@pws-pc.ntlworld.com> On 09/11/2007, Peter Stephenson wrote: > Peter Stephenson wrote: > > "Mikael Magnusson" wrote: > > > -- isn't documented in the manual for the zle builtin, but seems to do > > > the trick anyway. > > > > The function's been rewritten to use lower level facilities, so that > > shouldn't occur. > > I'm talking nonsense: no, it hasn't been rewritten and I must have been > looking at the wrong thing. However, I still don't understand > how you're getting that problem. Could you send a trace with "setopt > xtrace" both in there and in match-words-by-style (I presume it > depends on what word style is in effect since I can't se it)? 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. % -test bar delete-whole-word-match:zle:52: unknown option: test % bar with xtrace set and same sequence, +delete-whole-word-match:13> setopt extendedglob +delete-whole-word-match:15> local 'curcontext=:zle:kill-whole-word-match' +delete-whole-word-match:16> local -a matched_words +delete-whole-word-match:18> integer pos1 pos2 +delete-whole-word-match:20> autoload -U match-words-by-style +delete-whole-word-match:21> match-words-by-style +match-words-by-style:67> emulate -L zsh +match-words-by-style:68> setopt extendedglob +match-words-by-style:70> local wordstyle spacepat wordpat1 wordpat2 opt charskip wordchars wordclass +match-words-by-style:71> local match mbegin mend pat1 pat2 word1 word2 ws1 ws2 ws3 skip +match-words-by-style:72> local nwords MATCH MBEGIN MEND +match-words-by-style:74> local 'curcontext=:zle:kill-whole-word-match' +match-words-by-style:76> autoload -U match-word-context +match-words-by-style:77> match-word-context +match-word-context:5> emulate -L zsh +match-word-context:6> setopt extendedglob +match-word-context:8> local -a worcon bufwords +match-word-context:9> local pat tag lastword word +match-word-context:10> integer iword +match-word-context:12> zstyle -a :zle:kill-whole-word-match word-context worcon +match-word-context:12> return 0 +match-words-by-style:79> getopts w:s:c:C: opt +match-words-by-style:103> [[ -z '' ]] +match-words-by-style:103> zstyle -s :zle:kill-whole-word-match word-style wordstyle +match-words-by-style:104> [[ -z '' ]] +match-words-by-style:104> zstyle -s :zle:kill-whole-word-match skip-chars skip +match-words-by-style:105> [[ -z '' ]] +match-words-by-style:105> skip=0 +match-words-by-style:107> case shell (shell) +match-words-by-style:108> local bufwords +match-words-by-style:110> bufwords=( -t ) +match-words-by-style:111> nwords=1 +match-words-by-style:112> wordpat1=-t +match-words-by-style:116> bufwords=( est bar ) +match-words-by-style:117> wordpat2=est +match-words-by-style:118> spacepat='[[:space:]]#' +match-words-by-style:123> bufwords=( -test bar ) +match-words-by-style:124> (( 5 > 2 )) +match-words-by-style:127> eval 'pat1=${LBUFFER%%(#b)(-t)([[:space:]]#)}' +(eval):1> pat1='' +match-words-by-style:129> wordpat1=-t +match-words-by-style:130> wordpat2='est ' +match-words-by-style:132> wordpat1=-t +match-words-by-style:133> wordpat2='est\ ' +match-words-by-style:187> match=( ) +match-words-by-style:188> eval 'pat1=${LBUFFER%%(#b)(-t)([[:space:]]#)}' +(eval):1> pat1='' +match-words-by-style:189> word1=-t +match-words-by-style:190> ws1='' +match-words-by-style:192> match=( ) +match-words-by-style:193> charskip='' +match-words-by-style:196> eval 'pat2=${RBUFFER##(#b)([[:space:]]#)(est\ )([[:space:]]#)}' +(eval):1> pat2=bar +match-words-by-style:199> ws2='' +match-words-by-style:200> word2='est ' +match-words-by-style:201> ws3='' +match-words-by-style:203> matched_words=( '' -t '' '' 'est ' '' bar ) +delete-whole-word-match:23> [[ -n '' ]] +delete-whole-word-match:29> pos1=0 +delete-whole-word-match:32> [[ -n '' ]] +delete-whole-word-match:39> (( pos2 = CURSOR + 4 + 1 )) +delete-whole-word-match:44> (( CURSOR = pos1 )) +delete-whole-word-match:48> [[ kill-whole-word-match == '*kill*' ]] +delete-whole-word-match:49> local 'word=-test ' +delete-whole-word-match:50> [[ backward-char == '*kill*' ]] +delete-whole-word-match:53> zle copy-region-as-kill '-test ' delete-whole-word-match:zle:53: unknown option: test +delete-whole-word-match:56> BUFFER=bar Adding the -- fixes it as it instead runs +delete-whole-word-match:53> zle copy-region-as-kill -- -test In both cases, the end result is the same, but the error message messes up the display a bit in the first. -- Mikael Magnusson