emacs-devel
[Top][All Lists]
Advanced

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

Re: strip accents and sorting [was: BibTeX issues]


From: Roland Winkler
Subject: Re: strip accents and sorting [was: BibTeX issues]
Date: Fri, 30 Aug 2019 14:09:47 -0500

On Fri Aug 30 2019 Eli Zaretskii wrote:
> > You could set LC_COLLATE=en_US.utf8 inside Emacs, or even bind it
> > around the call to string-collate-lessp.  I think we support that on
> > GNU/Linux.
> 
> Actually, string-collate-lessp accepts an optional argument LOCALE
> that can be used for that.  So it's even easier than I remembered.

Thanks!  Unfortunately, string-collate-lessp with locale en_US.utf8
folds case,

(sort '("b" "A" "B" "a")
      (lambda (s1 s2) (string-collate-lessp s1 s2 "en_US.utf8")))
      ⇒ ("a" "A" "b" "B")

whereas

(sort '("b" "A" "B" "a")
      (lambda (s1 s2) (string-collate-lessp s1 s2 "C")))
      ⇒ ("A" "B" "a" "b")

though in both cases the optional arg IGNORE-CASE of
string-collate-lessp is nil.  (I guess this is not a bug of
string-collate-lessp, but it is an intended "feature" of the locale
en_US.utf8.)

Similarly, the locale en_US.utf8 ignores dots "." which for my taste
bundles too many features.  (Does anybody know where the feature
bundles of different locales are described?  So far, I have not
found anything.)

But something like bibtex-mode could introduce a new user option
bibtex-sort-locale that is used as optional arg when sorting BibTeX
records with string-collate-lessp.



reply via email to

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