[Top][All Lists]

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

Re: Proposed enhancement for `split-string'

From: Bozhidar Batsov
Subject: Re: Proposed enhancement for `split-string'
Date: Fri, 18 Jul 2014 15:24:00 +0300

Drew’s suggestion can be implemented a different function in subr-x I guess.


On July 15, 2014 at 3:04:48 AM, Stephen J. Turnbull (address@hidden) wrote:

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]