Subject: Re: bug#18051: 24.3.92; ls-lisp: Sorting; make ls-lisp-string-lessp a normal function?

From: Michael Albinus <[email-masked]>
Date: Wed, 27 Aug 2014 20:08:25 +0200

Glenn Morris <[email-masked]> writes:

> I'm missing something, because I don't get why you want me to write (in
> authors.el):
>
> (let ((process-environment
>        (cons "LC_COLLATE=en_US.UTF-8"
>              process-environment)))
>   (sort authors-author-list
>         (lambda (a b) (string-collate-lessp (car a) (car b)))))
>
> rather than the obviously-better:
>
> (sort authors-author-list
>       (lambda (a b) (string-collate-lessp (car a) (car b) "en_US.UTF-8")))
>
> Normally one controls functions through their arguments, not the
> environment.

authors.el is a special case:

- Your sort predicate is not an existing function, but a
  lambda. Usually, I would expect something like

  (sort any-list 'string-collate-lessp)

- You use a hard-coded value for the locale. The intention is to make it
  configurable for the user.

If, for example, a user wants to use another collation order but the one
given by "en_US.UTF-8", you end up in offering a variable which can be
set. Don't know whether this is desirable in authors.el, 'tho.

Best regards, Michael.