emacs-devel
[Top][All Lists]
Advanced

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

Collation tests in fns-tests.el


From: Ken Brown
Subject: Collation tests in fns-tests.el
Date: Fri, 30 Oct 2015 13:51:45 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Hi Michael,

I'm curious why you put the following test in fns-tests.el:

;; Punctuation and whitespace characters are not taken into account
  ;; for collation in other locales.
  (should
   (equal
    (sort '("11" "12" "1 1" "1 2" "1.1" "1.2")
          (lambda (a b)
            (let ((w32-collate-ignore-punctuation t))
              (string-collate-lessp
               a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
    '("11" "1 1" "1.1" "12" "1 2" "1.2")))

This suggests that punctuation and whitespace should definitely not be taken into account in non-POSIX locales. But the docstring of 'sort' is much less definitive:

"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." [My emphasis.]

Is there some place where emacs relies on punctuation and whitespace being ignored? That certainly isn't the case on all supported systems, nor is it mandated by POSIX.

Ken

P.S. My question is motivated by the fact that punctuation and whitespace are not ignored on Cygwin in non-POSIX locales, and it does not seem to be easy to make this happen. If you're interested in the gory details, start here:

  https://www.cygwin.com/ml/cygwin/2015-10/msg00516.html



reply via email to

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