emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Human-readable file sorting


From: Eli Zaretskii
Subject: Re: Human-readable file sorting
Date: Sat, 20 Feb 2016 13:36:58 +0200

> From: Lars Ingebrigtsen <address@hidden>
> Cc: address@hidden
> Date: Sat, 20 Feb 2016 22:32:02 +1100
> 
> Eli Zaretskii <address@hidden> writes:
> 
> > Please don't call that function `file-string-lessp', or anything that
> > has "file" in it.  This sorting order has nothing to do with files.
> 
> Well, this is the function that's supposed to sort file names in the
> order requested by the user

I think it's supposed to sort strings while treating numeric parts of
them specially.  Its usage domain is wider than just file names.

> > Btw, ls-lisp by default doesn't use string-lessp, it uses
> > string-collate-lessp.
> 
> Hm, interesting...
> 
> (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") 'string-collate-lessp)
>   => ("11" "1 1" "1.1" "12" "1 2" "1.2")

You will see that 'ls' in a UTF-8 locale does the same.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]