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: Re: Human-readable file sorting Date: Sat, 20 Feb 2016 13:26:51 +1100 Message-ID: <87bn7c3yms.fsf@gnus.org> References: <87povs41xg.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1455935274 28616 80.91.229.3 (20 Feb 2016 02:27:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Feb 2016 02:27:54 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 20 03:27:44 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 1aWxGp-0000CO-DO for ged-emacs-devel@m.gmane.org; Sat, 20 Feb 2016 03:27:43 +0100 Original-Received: from localhost ([::1]:57261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWxGo-0003ni-LL for ged-emacs-devel@m.gmane.org; Fri, 19 Feb 2016 21:27:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWxGi-0003nO-U9 for emacs-devel@gnu.org; Fri, 19 Feb 2016 21:27:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWxGe-000642-UD for emacs-devel@gnu.org; Fri, 19 Feb 2016 21:27:36 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:54665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWxGe-00063l-NU for emacs-devel@gnu.org; Fri, 19 Feb 2016 21:27:32 -0500 Original-Received: from 46.156.62.243.tmi.telenormobil.no ([46.156.62.243] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aWxG8-00055c-Vd for emacs-devel@gnu.org; Sat, 20 Feb 2016 03:27:01 +0100 In-Reply-To: (John Wiegley's message of "Fri, 19 Feb 2016 17:58:20 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aWxG8-00055c-Vd MailScanner-NULL-Check: 1456540022.57032@yPONW9GQzyi4KovEuwng9A X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 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:200258 Archived-At: John Wiegley writes: >>>>>> Lars Ingebrigtsen writes: > >> So what do all y'all think? > > It looks like GNU ls support "human sorting" using -v, so you can always use > C-u s to add this flag, or change your default set of flags to use it. > > Whether it needs to be the dired sorting default... I don't see a strong need > for that, given that it can be customized. Well, it's not just dired. For instance, if you say `C-x f file', you get a help buffer listing all the files that match. This should also be sorted in a human readable fashion. When you push `n' in an image mode buffer, it takes you to the next file, and that should also be the next, as humans see it. This stuff is all over Emacs, and it's either because the functions rely on the sorting from `directory-files', or because they call `string-lessp' explicitly. The practical way to implement this is to provide a `file-string-lessp' function that can be configured to sort the way the user prefers, defaulting to human readable sorting, and then we adjust `directory-files' and other file-ey commands to call that instead of `string-lessp'. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no