unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: emacs-devel@gnu.org
Subject: Proposed enhancement for `split-string'
Date: Tue, 15 Jul 2014 09:03:26 +0900	[thread overview]
Message-ID: <87zjgbcwtt.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <7025b422-78b5-4b17-b199-70cbb1f6de93@default>

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	other threads:[~2014-07-15  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 22:51 Proposed enhancement for `split-string' Drew Adams
2014-07-15  0:03 ` Stephen J. Turnbull [this message]
2014-07-18 12:24   ` Bozhidar Batsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjgbcwtt.fsf@uwakimon.sk.tsukuba.ac.jp \
    --to=stephen@xemacs.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).