Subject: bug#18051: 24.3.92; ls-lisp: Sorting; make ls-lisp-string-lessp a normal function?

From: Eli Zaretskii <[email-masked]>
Date: Sat, 19 Jul 2014 11:17:15 +0300

> From: Michael Heerdegen <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 19 Jul 2014 03:25:01 +0200
> 
> over the current sorting, I would much prefer having all the dot
> files at the end.  (I don't know if this is possible with ls.)

If 'ls' cannot do that, I think we should have this in Dired.

> > But if 'ls' supports that, so should ls-lisp.
> 
> It depends on "locale" settings.  I tried some settings of the LC_ALL
> variable.  With "C" or "POSIX", I get the same sorting as with ls-lisp.
> OTOH, with "en_US.utf8" or "de_DE.utf8" I get the sorting I described,
> with dot files merged with the other files.

AFAICT, 'ls' uses strcoll.  I don't see how can that effectively
ignore the leading dot, but maybe I'm missing something.  OTOH, if the
UTF-8 codeset says the leading dot should be ignored, then ls-lisp
should do the same by default, at least when the locale's codeset is
UTF-8.

Can you see the answer in 'ls' sources?  Does just "en_US" or
"en_US.8859-1" change the order?

> > >   (2) -v sorting (sorting versions correctly)
> >
> > Isn't this what "ls -v" does?  If so, and if ls-lisp doesn't currently
> > support that, patches to add such support are welcome.
> 
> ls -v sorts backup versions in their natural order (which is not the
> lexicographic order).  Yes, would be good to have that in ls-lisp, and
> should not be too hard.  I can give it a try when I get the time.

Thanks.

> I'm not sure what would have to be done about the locale depend part.

Assuming it's indeed the locale thing, Emacs doesn't yet support
locale-specific sorting.  But we could do that in some ad-hoc manner
anyway.