[Top][All Lists]

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

Proposed enhancement for `split-string'

From: Stephen J. Turnbull
Subject: Proposed enhancement for `split-string'
Date: Tue, 15 Jul 2014 09:03:26 +0900

Drew Adams writes:

 > The second arg, HOW, can be a regexp, giving the same behavior as now.
 > Alternatively, HOW can be (1) a character predicate or (2) a doubleton
 > plist (PROPERTY VALUE), where PROPERTY is a text property and VALUE is
 > one of its possible values.

Why not just allow it to be any function returning an interval (with
implicit argument = (point)), and provide appropriate functions to
accomplish the tasks you propose?

 > By providing non-nil TEST you can test, for example:
 > * Whether the actual value of text property `invisible' belongs to the
 >   current `buffer-invisibility-spec'.
 > * Whether a particular face is among the faces that are the value of
 >   property `face'.

A general predicate for HOW could do this, too.

 > Non-nil optional arg FLIP simply swaps the separators and the kept
 > substrings - regardless of HOW the separating is defined.

This can be done for the "standard" functions by providing an optional
FLIP argument, and using (lambda () (how-func 'flip-me)) as the HOW.
Alternatively you could provide flipped standard HOW functions.

I have no objection to a new function `split-string-à-la-drew' with
any signature you like, but `split-string' should keep as simple a
signature as possible.

reply via email to

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