From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Nordl=F6w?= Newsgroups: gmane.emacs.help Subject: Re: Sorting directory-files on their extension Date: Wed, 7 Oct 2009 08:11:00 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9fd0a6fe-430a-4049-9647-beed044ca3b2@m1g2000vbi.googlegroups.com> 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: ger.gmane.org 1254930059 31740 80.91.229.12 (7 Oct 2009 15:40:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Oct 2009 15:40:59 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 07 17:40:49 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MvYdF-00056v-Kq for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Oct 2009 17:40:49 +0200 Original-Received: from localhost ([127.0.0.1]:36819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvYdF-0004br-29 for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Oct 2009 11:40:49 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!postnews.google.com!m1g2000vbi.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 15 Original-NNTP-Posting-Host: 150.227.15.253 Original-X-Trace: posting.google.com 1254928260 19498 127.0.0.1 (7 Oct 2009 15:11:00 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 7 Oct 2009 15:11:00 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m1g2000vbi.googlegroups.com; posting-host=150.227.15.253; posting-account=ytJKAgoAAAA1tg4ScoRszebXiIldA5vg User-Agent: G2/1.0 X-HTTP-Via: 1.1 ip1-w.foi.se:8080 (IronPort-WSA/6.3.0-523) X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.1 (KHTML, like Gecko) Chrome/4.0.219.0 Safari/532.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:173638 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:68730 Archived-At: On Oct 7, 4:35=A0pm, Nordl=F6w wrote: > Does Emacs contain any built-in features for sorting file-names (list > of strings) on their (file) extension? > > /NOrdl=F6w Is this a good candidate?: (defun compare-extensions (a b) (compare-strings (file-name-extension a) 0 (length (file-name-extension a)) (file-name-extension b) 0 (length (file-name-extension b)))) ;; Use: (sort '("a.c" "a.h" "b.c" "b.h") 'compare-extensions) /Nordl=F6w