emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enable sorting by version in `ls-lisp-handle-switches'


From: Stefan Monnier
Subject: Re: enable sorting by version in `ls-lisp-handle-switches'
Date: Thu, 11 Mar 2010 14:20:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux)

>> You may also want to take a look at mpc-compare-strings which does
>> something similar, tho simpler (not specific to versions, just taking
>> care of numbers).
> I checked `mpc-compare-strings'.
> `mpc-compare-strings' and `string-logical-lessp' are different.

Indeed, I don't expect them to behave identically.

>   (mpc-compare-strings "01-00001" "1-1") => 1
>   (string-logical-lessp "01-00001" "1-1") => nil

>   (mpc-compare-strings "1-1" "01-00001") => -1
>   (string-logical-lessp "1-1" "01-00001") => nil

I remember having struggled over "correct" handling (meaning, making
sure that it's transitive) of leading zeroes in
mpc-compare-strings, so I'm not very surprised.

I don't really care whether "1-1" is considered larger, smaller or
equivalent to "01-00001".  I don't think such issues show up much in
practice and I'm not sure as a user I'd prefer one over the other.

The implementation strategy is also very different, so I'd expect the
performance behavior to be quite different as well.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]