From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Tilford Newsgroups: gmane.emacs.help Subject: Re: Sorting on compound keys? Date: Sun, 29 May 2011 16:50:54 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1306705869 20947 80.91.229.12 (29 May 2011 21:51:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 29 May 2011 21:51:09 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 29 23:51:05 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 1QQnt0-0001TJ-Lf for geh-help-gnu-emacs@m.gmane.org; Sun, 29 May 2011 23:51:02 +0200 Original-Received: from localhost ([::1]:55002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQnt0-0006tw-84 for geh-help-gnu-emacs@m.gmane.org; Sun, 29 May 2011 17:51:02 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQnsu-0006tb-DJ for help-gnu-emacs@gnu.org; Sun, 29 May 2011 17:50:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQnst-00047X-Gi for help-gnu-emacs@gnu.org; Sun, 29 May 2011 17:50:56 -0400 Original-Received: from mail-iw0-f169.google.com ([209.85.214.169]:39992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQnst-00047M-C1 for help-gnu-emacs@gnu.org; Sun, 29 May 2011 17:50:55 -0400 Original-Received: by iwg8 with SMTP id 8so4240762iwg.0 for ; Sun, 29 May 2011 14:50:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=faxJPv7NngDTm4kGDNBT41OVMTkKR4QhxPedQ5kedT4=; b=WzXvMJln7ujNwHHlVssNDaxNlZyiRiOhuWsvDdWXZuzE8XKcJF8XpL8l3tns7562mS vvz8sSvFv6Wh09M1M7E49EMT4kaBuwg62sOWDr7uRh305l6PKZ+/K7RT+k78k8y5ZZF3 7kJwPsesjCe1yRzqpWptaRSPUewcawV2DxODU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=JpXsw3IJaXT27uDPR1oMUEhNMht5bayx1kacUj2XicjsmJ9nD6PUMvzKQFG3jgfmuP Sr20eSqm4FYwUZxa2N/Y4XTJtc7J2vx4T8U/yXR+V5mpwWj7ghR+CEcttGgMQ07HqN1z PiST/9BAo9/zYSFa9lf7FlVVzHdB51IZtWKVQ= Original-Received: by 10.231.61.83 with SMTP id s19mr5405052ibh.19.1306705854060; Sun, 29 May 2011 14:50:54 -0700 (PDT) Original-Received: by 10.231.15.68 with HTTP; Sun, 29 May 2011 14:50:54 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.169 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:81263 Archived-At: On Tue, May 24, 2011 at 3:57 PM, Tim Landscheidt w= rote: > Hi, > > 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. > > =A0Is 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. > > Tim Is there an option to do a stable sort, such as mergesort?