[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Human-readable file sorting
From: |
Lars Ingebrigtsen |
Subject: |
Human-readable file sorting |
Date: |
Sat, 20 Feb 2016 12:15:39 +1100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Most file browsers these days sort files that have mixed
alphabetic/numerical content in a "logical" way for humans, and not
strictly according to their character values. I wrote a bit about it,
but forgot to start the discussion here. :-)
http://lars.ingebrigtsen.no/2014/10/13/campaign-for-humane-sorting/
To summarise:
When you have a directory with files like
file8.png
file9.png
file10.png
file11.png
humans recognise that these have increasing numerical content, and that
they probably should be sorted this way. However, Emacs will sort them
this way:
file10.png
file11.png
file8.png
file9.png
Most modern file browsers will sort these files the human way, and I
think that Emacs should, too.
This applies to dired, but also to functions like `(directory-files
foo)'. Possibly via new parameters or something, but I kinda think
that's not necessary.
Of course, we could have endless discussions about "what's a consecutive
sequence of numbers?" Like file1,004.45.png? Is that one number or
three? But I don't think we need to. :-) It's three. We get 99% of
the use cases right by just being simple and stupid, I think. (See the
longer discussion on the blog.)
So what do all y'all think?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Human-readable file sorting,
Lars Ingebrigtsen <=
- Re: Human-readable file sorting, John Wiegley, 2016/02/19
- Re: Human-readable file sorting, Lars Ingebrigtsen, 2016/02/19
- Re: Human-readable file sorting, John Wiegley, 2016/02/19
- Re: Human-readable file sorting, Lars Ingebrigtsen, 2016/02/20
- Re: Human-readable file sorting, Marcin Borkowski, 2016/02/20
- Re: Human-readable file sorting, Lars Ingebrigtsen, 2016/02/20
- Re: Human-readable file sorting, Marcin Borkowski, 2016/02/20
- Re: Human-readable file sorting, Nikolaus Rath, 2016/02/22
- Re: Human-readable file sorting, Marcin Borkowski, 2016/02/22
- Re: Human-readable file sorting, Yuri Khan, 2016/02/23