From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2406 invoked from network); 6 May 2009 17:27:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 6 May 2009 17:27:00 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 57901 invoked from network); 6 May 2009 17:26:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 May 2009 17:26:51 -0000 Received: (qmail 11058 invoked by alias); 6 May 2009 17:26:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26939 Received: (qmail 11040 invoked from network); 6 May 2009 17:26:37 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 6 May 2009 17:26:37 -0000 Received: from cork.scru.org (cork.scru.org [209.20.67.2]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 2D5BA80590A3 for ; Wed, 6 May 2009 19:26:17 +0200 (CEST) Received: by cork.scru.org (Postfix, from userid 1000) id 16DF010494D; Wed, 6 May 2009 17:26:31 +0000 (UTC) Date: Wed, 6 May 2009 17:26:31 +0000 From: Clint Adams To: martin f krafft , 527301@bugs.debian.org Cc: zsh-workers@sunsite.dk Subject: Re: Bug#527301: _xmms2 jump/_values: suboptimal presentation/sorting Message-ID: <20090506172631.GA2668@scru.org> Mail-Followup-To: martin f krafft , 527301@bugs.debian.org, zsh-workers@sunsite.dk References: <20090506162216.GA24031@piper.oerlikon.madduck.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090506162216.GA24031@piper.oerlikon.madduck.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV 0.92.1/9333/Wed May 6 05:55:26 2009 on bifrost X-Virus-Status: Clean On Wed, May 06, 2009 at 06:22:16PM +0200, martin f krafft wrote: > `xmms2 jump` completion uses > > _values -s ' ' 'playlist items' ${(On)playlistitems} > > where $playlistitems is an array with items e.g. > > 1[foo] > 2[bar] > ... > 12[baz] > 13[foo] > > Unfortunately, it seems as if _values does something weird: > Even though ${(On)...} yields a reverse-numerically sorted list of > those items, the output seems not numerically sorted. > > In addition, the way _values merges keys with the same value (1 and > 13 in the above) is suboptimal for the use case. > > This list: > > [0/193] Deep Purple - Highway Star (06:43) > [1/194] Deep Purple - Child in Time (12:17) > [2/195] Deep Purple - Smoke on the Water (07:36) > [3/196] Deep Purple - The Mule (09:28) > [4/197] Deep Purple - Strange Kind of Woman (09:52) > [5/198] Deep Purple - Lazy (10:27) > [6/199] Deep Purple - Space Truckin' (19:54) > [7/200] Deep Purple - Black Night (06:18) > [8/201] Deep Purple - Speed King (07:24) > [9/202] Deep Purple - Lucille (08:03) > [10/203] Deep Purple - Highway Star (06:41) > [11/204] Deep Purple - Black Night (05:48) > [12/205] Deep Purple - A Twist in the Tail (04:23) > [13/206] Deep Purple - Perfect Strangers (06:52) > [14/207] Deep Purple - Anyone's Daugher (03:52) > [15/208] Deep Purple - Child in Time (10:42) > [16/209] Deep Purple - Anya (12:08) > [17/210] Deep Purple - Speed King (07:33) > [18/211] Deep Purple - Smoke on the Water (10:09) > > Yields this completion output: > > playlist items > 10 -- Deep Purple - Highway Star > 11 7 -- Deep Purple - Black Night > 12 -- Deep Purple - A Twist in the Tail > 13 -- Deep Purple - Perfect Strangers > 14 -- Deep Purple - Anyone's Daugher > 15 1 -- Deep Purple - Child in Time > 16 -- Deep Purple - Anya > 17 8 -- Deep Purple - Speed King > 18 2 -- Deep Purple - Smoke on the Water > 3 -- Deep Purple - The Mule > 4 -- Deep Purple - Strange Kind of Woman > 5 -- Deep Purple - Lazy > 6 -- Deep Purple - Space Truckin' > 9 -- Deep Purple - Lucille > > I am sure you'll agree that that's not really useful. It would be > better to have proper numeric sorting and disable the merging. You can try this for yourself: zstyle :completion::complete:xmms2:\*:values list-grouped false zstyle :completion::complete:xmms2:\*:values sort false I have no opinion on how the default behavior should be handled. Also, setting IFS to "oldIFS" doesn't seem useful, so here's some cleanup. Index: Completion/Unix/Command/_xmms2 =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_xmms2,v retrieving revision 1.2 diff -u -r1.2 _xmms2 --- Completion/Unix/Command/_xmms2 5 May 2009 08:47:55 -0000 1.2 +++ Completion/Unix/Command/_xmms2 6 May 2009 17:22:18 -0000 @@ -55,14 +55,11 @@ } _xmms2_jump() { - oldIFS=$IFS - IFS=$'\n' - songlist=($(xmms2 list)) - IFS=oldIFS - playlistitems="" + songlist=(${"$(xmms2 list)"}) + playlistitems=() for song ($songlist); do if [[ $song = (#b)' '\[(<->)/(<->)\]' '(*)' '\((*)\) ]]; then - playlistitems=($playlistitems "$match[1][$match[3]]") + playlistitems+=("$match[1][$match[3]]") fi done