GNU bug report logs - #59275
Unexpected return value of `string-collate-lessp' on Mac

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Tue, 15 Nov 2022 04:08:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 59275 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 59275 <at> debbugs.gnu.org
Subject: Re: bug#59275: Unexpected return value of `string-collate-lessp' on
 Mac
Date: Tue, 15 Nov 2022 17:16:14 +0200
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Cc: 59275 <at> debbugs.gnu.org
> Date: Tue, 15 Nov 2022 15:05:48 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > string-collate-lessp is inherently platform- (and locale-) dependent.
> > Don't use it if you want consistent results across platforms and
> > locales.
> 
> Is there a better alternative?

Alternative to do what job?

> Also, do I miss something, or is this pitfall not documented in the
> docstring of `string-collate-lessp'?

It isn't? then what is this about:

  This function obeys the conventions for collation order in your
  locale settings.  For example, punctuation and whitespace characters
  might be considered less significant for sorting:

  (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") 'string-collate-lessp)
    => ("11" "1 1" "1.1" "12" "1 2" "1.2")
  [...]
  To emulate Unicode-compliant collation on MS-Windows systems,
  bind ‘w32-collate-ignore-punctuation’ to a non-nil value, since
  the codeset part of the locale cannot be "UTF-8" on MS-Windows.

The ELisp manual says in addition:

     This behavior is system-dependent; e.g., punctuation and whitespace
     are never ignored on Cygwin, regardless of locale.

If this doesn't have a big WARNING sign near it, then what would?




This bug report was last modified 2 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.