[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sorting directory-files on their extension
From: |
Nordlöw |
Subject: |
Re: Sorting directory-files on their extension |
Date: |
Wed, 7 Oct 2009 08:11:00 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Oct 7, 4:35 pm, Nordlöw <per.nord...@gmail.com> wrote:
> Does Emacs contain any built-in features for sorting file-names (list
> of strings) on their (file) extension?
>
> /NOrdlöw
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öw