From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13847 invoked from network); 28 Dec 2005 03:57:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) 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.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Dec 2005 03:57:31 -0000 Received: (qmail 57260 invoked from network); 28 Dec 2005 03:57:24 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Dec 2005 03:57:24 -0000 Received: (qmail 19954 invoked by alias); 28 Dec 2005 03:57:16 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9799 Received: (qmail 19942 invoked from network); 28 Dec 2005 03:57:15 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 Dec 2005 03:57:15 -0000 Received: (qmail 56125 invoked from network); 28 Dec 2005 03:57:15 -0000 Received: from pop06.mail.atl.earthlink.net (207.69.200.40) by a.mx.sunsite.dk with SMTP; 28 Dec 2005 03:57:15 -0000 Received: from h-68-166-5-97.atlngahp.dynamic.covad.net ([68.166.5.97] helo=shazam.localnet) by pop06.mail.atl.earthlink.net with esmtp (Exim 3.36 #10) id 1ErSR7-00062J-00 for zsh-users@sunsite.dk; Tue, 27 Dec 2005 22:57:13 -0500 Received: from jhankins by shazam.localnet with local (Exim 3.36 #1 (Debian)) id 1ErSR6-0001SM-00 for ; Tue, 27 Dec 2005 21:57:12 -0600 From: Jonathan Hankins To: zsh-users@sunsite.dk Subject: Glob sort specifier ideas Date: Tue, 27 Dec 2005 21:57:12 -0600 Message-ID: <87k6dpj2lj.fsf@shazam.localnet> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Jonathan Hankins Here are 2 ideas for new glob sort specifiers: ou for "unsorted" directory order (like "-U" in GNU ls(1)). oe:string: to run "string" as shell code, like the e:: glob specifier. This would allow user code to hook into the glob sort system. It would work like sort and the "cmp" or "<=>" operators in perl, taking 2 files as arguments, returning -1, 0 or 1 file1 is "less than", "equal to" or "greater than" file2 in the sort order. An example use for the oe:string: specifier would be this. I recently had a set of patches that shipped as ARJ files. I needed to extract them in time stamp order on top of an existing directory hierarchy. The ARJ files all had the same mtime, but the ARJ header stores a time stamp when the archive is created. I created a function to extract the time stamp from each of the files, and sorted them on that. It would be cool to be able to do something like: for x in *.arj(oe:myfunc:); do arj x base_dir $x; done Where myfunc would get called repeatedly as "myfunc file1.arj file2.arj", returning -1, 0 or 1 to the glob sort system (or whatever) that would allow it to sort the file list into order. Thanks, -Jonathan Hankins -- +------------------+-----------------------------------------------------+ |Jonathan Hankins | jonathan-hankins@mindspring.com | +------------------+-----------------------------------------------------+