emacs-devel
[Top][All Lists]
Advanced

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

Re: Human-readable file sorting


From: Lars Ingebrigtsen
Subject: Re: Human-readable file sorting
Date: Sat, 20 Feb 2016 22:32:02 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

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, so that it has "file" in the name makes
sense to me.  `file-name-lessp' is probably better, though.

> Names I can suggest include "logical", "intuitive", and "numerical".

Those are names for sorting predicates that behave in a specific manner,
and not something that directory-files (etc) should call directly.

> 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")

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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