From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Human-readable file sorting Date: Sat, 20 Feb 2016 12:15:39 +1100 Organization: Programmerer Ingebrigtsen Message-ID: <87povs41xg.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1455930997 2454 80.91.229.3 (20 Feb 2016 01:16:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Feb 2016 01:16:37 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 20 02:16:27 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aWw9r-0000RR-BX for ged-emacs-devel@m.gmane.org; Sat, 20 Feb 2016 02:16:27 +0100 Original-Received: from localhost ([::1]:56887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWw9q-0000NN-HE for ged-emacs-devel@m.gmane.org; Fri, 19 Feb 2016 20:16:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWw9c-0000LD-TK for emacs-devel@gnu.org; Fri, 19 Feb 2016 20:16:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWw9Z-000678-KF for emacs-devel@gnu.org; Fri, 19 Feb 2016 20:16:12 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:51507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWw9Z-00066y-D7 for emacs-devel@gnu.org; Fri, 19 Feb 2016 20:16:09 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aWw9X-0000AP-0k for emacs-devel@gnu.org; Sat, 20 Feb 2016 02:16:07 +0100 Original-Received: from 46.156.62.243.tmi.telenormobil.no ([46.156.62.243]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Feb 2016 02:16:07 +0100 Original-Received: from larsi by 46.156.62.243.tmi.telenormobil.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Feb 2016 02:16:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 46.156.62.243.tmi.telenormobil.no Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:NOmkOx2ZBMANf1HWc6z2dOCSrrI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200253 Archived-At: 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