From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Landscheidt Newsgroups: gmane.emacs.help Subject: Re: Sorting on compound keys? Date: Wed, 25 May 2011 22:08:06 +0000 Organization: Message-ID: References: <4DDC9A94.3080903@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1306361310 14410 80.91.229.12 (25 May 2011 22:08:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 25 May 2011 22:08:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 26 00:08:27 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QPMFe-0006FH-M7 for geh-help-gnu-emacs@m.gmane.org; Thu, 26 May 2011 00:08:26 +0200 Original-Received: from localhost ([::1]:44407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPMFe-0003gR-6S for geh-help-gnu-emacs@m.gmane.org; Wed, 25 May 2011 18:08:26 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPMFZ-0003gB-C4 for help-gnu-emacs@gnu.org; Wed, 25 May 2011 18:08:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPMFY-0008Ga-6P for help-gnu-emacs@gnu.org; Wed, 25 May 2011 18:08:21 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:41582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPMFY-0008GU-0l for help-gnu-emacs@gnu.org; Wed, 25 May 2011 18:08:20 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QPMFW-0006DT-ER for help-gnu-emacs@gnu.org; Thu, 26 May 2011 00:08:18 +0200 Original-Received: from g224045026.adsl.alicedsl.de ([92.224.45.26]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 26 May 2011 00:08:18 +0200 Original-Received: from tim by g224045026.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 26 May 2011 00:08:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 35 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: g224045026.adsl.alicedsl.de Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:zZLC3yn51PZOVZToIf9Z/Km1rUM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81246 Archived-At: Andreas Röhler wrote: >> sometimes I want to sort unified diffs of CSV files (sepa- >> rated by tabs (here: \t)): >> | +A 1\t1\tx >> | +A 1\t2\ty >> | +B 2\t3\tz >> | -A 1\t1\tx >> | -B 2\t2\ty >> | -B 2\t3\tz >> by the second column, then the first column, then "+" vs. >> "-". Unfortunately, it seems that sort-regexp-fields doesn't >> allow more than one match field as a key. sort-fields >> doesn't work either as it requires the fields to be sur- >> rounded by white space (no "+" vs. "-") and doesn't allow >> white space inside the fields. >> Is there any function in vanilla Emacs (23.1.1) that I >> missed? I looked at pimping sort-regexp-fields, but it seems >> to me that sort-subr would have to be rewritten from scratch >> to achieve sorting on compound keys. > last time I looked into that feature was missing indeed. > However, didn't look for a need of re-write from the > scratch, just to extend to existing routine - ie. introduce > one or more levels of sorting. I remember our discussion in de.comp.editoren :-), but as I read sort-subr it is hard-coded that the sort key is one literal, continuous part of the buffer as sort-lists is a list of buffer positions. Tim