[Top][All Lists]

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

Re: sort-lines including non ASCII

From: Michael Heerdegen
Subject: Re: sort-lines including non ASCII
Date: Fri, 08 Jul 2016 16:36:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux)

Richard Stallman <address@hidden> writes:

> Could you please show a concrete example of the code you propose ought
> to be accepted?  The only way that occurs to me, to transform an
> arbitrary predicate, is to write a lambda expression around it which
> will handle the arguments as they are actually passed.  That doesn't
> require any change in Emacs.

So far I only fixed a quoted lambda causing a bug, and made `sort-lines'
accept a PREDICATE argument.  This is useful because until now, the user
had to duplicate the function's code if he wanted to specify a
predicate for sorting lines.

The first step (implemented by the patch so far) allows to call
`sort-lines' like

  (sort-lines nil beg end #'string<)

I think it is more useful to make the predicate accept something
reasonable (strings) than some data structure used in the implementation
of `sort-subr'.  That's why the predicate passed to `sort-subr' needs to
be wrapped in a lambda.

The second step will be to implement a command named
`sort-lines-collate' or so that prompts for arguments (like the locale
to use) and calls `sort-lines' with the corresponding arguments.

Does that answer your question?


reply via email to

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