[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 71783e9: Add the string-numeric-lessp function
From: |
Juri Linkov |
Subject: |
Re: master 71783e9: Add the string-numeric-lessp function |
Date: |
Mon, 07 Mar 2016 02:16:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (x86_64-pc-linux-gnu) |
> At least, that's been the tradition in other GNU tools. GNU ls -v applies
> the string-version-lessp algorithm to every pair of file names that it
> considers, and it works on arbitrary file names. It sounds like you may be
> thinking of some other tradition, although I'm not sure what that tradition
> would be.
>
> The GNU ls -v approach works well in practice, because people who care
> about version numbers tend to name their files consistently. E.g., they do
> not put files "foo001.png" "foo1.png" in the same directory, because that
> kind of usage would confuse humans no matter what 'ls -v' does.
I tried GNU ls -v, but unfortunately it is unusable because of a bug in
GNU ls -v. It places backup files before original files, e.g. `ls -lv`
-rw-r--r-- 1 158,018 Feb 23 12:01 dired.el
-rw-r--r-- 1 117,286 Feb 23 12:23 dired.elc
-rw-r--r-- 1 110,076 Feb 23 12:01 dired-aux.el
-rw-r--r-- 1 81,586 Feb 23 12:23 dired-aux.elc
-rw-r--r-- 1 253 Feb 23 12:12 dired-loaddefs.el~
-rw-r--r-- 1 20,628 Feb 23 12:12 dired-loaddefs.el
-rw-r--r-- 1 66,420 Feb 23 12:01 dired-x.el
-rw-r--r-- 1 47,687 Feb 23 12:23 dired-x.elc
dired-loaddefs.el~ is sorted to come before dired-loaddefs.el
whereas in `ls -l`
-rw-r--r-- 1 110,076 Feb 23 12:01 dired-aux.el
-rw-r--r-- 1 81,586 Feb 23 12:23 dired-aux.elc
-rw-r--r-- 1 158,018 Feb 23 12:01 dired.el
-rw-r--r-- 1 117,286 Feb 23 12:23 dired.elc
-rw-r--r-- 1 20,628 Feb 23 12:12 dired-loaddefs.el
-rw-r--r-- 1 253 Feb 23 12:12 dired-loaddefs.el~
-rw-r--r-- 1 66,420 Feb 23 12:01 dired-x.el
-rw-r--r-- 1 47,687 Feb 23 12:23 dired-x.elc
dired-loaddefs.el~ naturally comes after dired-loaddefs.el
(as dired.elc naturally comes after dired.el).
The same bug now propagates to ‘string-version-lessp’:
(sort '(
"dired.el"
"dired.elc"
"dired-aux.el"
"dired-aux.elc"
"dired-loaddefs.el"
"dired-loaddefs.el~"
"dired-x.el"
"dired-x.elc"
)
'string-version-lessp)
=>
"dired.el"
"dired.elc"
"dired-aux.el"
"dired-aux.elc"
"dired-loaddefs.el~" <=
"dired-loaddefs.el" <=
"dired-x.el"
"dired-x.elc"
- Re: master 71783e9: Add the string-numeric-lessp function,
Juri Linkov <=
RE: master 71783e9: Add the string-numeric-lessp function, Drew Adams, 2016/03/06