emacs-devel
[Top][All Lists]
Advanced

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

Re: sort-lines including non ASCII


From: Óscar Fuentes
Subject: Re: sort-lines including non ASCII
Date: Tue, 05 Jul 2016 23:57:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Uwe Brauer <address@hidden> writes:

> Take the following Spanish example.
>
> Arrieta 
> Anton   
> Álvarez
>
>
> Using sort-lines *does* not result in
>
> Álvarez
> Anton   
> Arrieta 
>
> But in 
>
> Anton   
> Arrieta 
> Álvarez
>
> Which is contra intuitive. Does anybody know about a function with such
> a feature? Any plans?

(sort (list "Arrieta" "Antón" "Álvarez") 'string-collate-lessp)

If that doesn't work, check your LOCALE (or LANG) environment variable
(see the docstring of string-collate-lessp for details).

Someting like

(sort (list "Antón" "Arrieta" "Álvarez")
      (lambda (a b)
        (string-collate-lessp a b "es_ES.UTF-8" t)))

should do the right thing regardless of your environment variables (at
least on GNU/Linux).




reply via email to

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