help-gnu-emacs
[Top][All Lists]
Advanced

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

Sorting buffer with string-collate-lessp


From: Rasmus
Subject: Sorting buffer with string-collate-lessp
Date: Tue, 26 May 2015 13:53:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi,

How can I easily sort a buffer using string-collate-lessp?

Info: I would like to sort a buffer using string-collate-lessp (line by
line).  Sort-lines is the obvious candidate but it uses string<.  I tried
to write my own sort-lines using sort-subr, as it has a predicate
argument.  However, for buffers, it needs something like
compare-buffer-substrings, which takes no predicate and is in the C-level
and pretty long.

I could write a wrapper that convert each buffer-chunk into its
buffer-substring first, and then compares it with string-collate-lessp, I
guess, but that seems like a lot of boiler plate.  So maybe a better
solution exists?

Bonus point if one can specify something simple and intuitive as
string-collate-lessp in a defcustom.

Thanks,
Rasmus

-- 
History is what should never happen again




reply via email to

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