[cl-ppcre-devel] Using cl-ppcre in a text editor

Lawrence Mitchell wencel at gmail.com
Sat Jan 29 16:16:50 UTC 2005


Hello there,

I'm looking at trying to use cl-ppcre to add regular expression
support to the Climacs editor  (<URL:
http://common-lisp.net/project/climacs/>).  A few things spring to
mind:

o Licensing differences.  Climacs is released under the LGPL, while
cl-ppcre is under as BSD-style license.  I don't think this is a
problem (as far as I can tell from reading the licenses), but if you
know otherwise, I'd be grateful to hear.

o How to best match up cl-ppcre's matching on strings with climacs'
idea of a buffer.

A climacs buffer is a sequence of objects (which may or may not be
characters, but we'll ignore that for the moment).  Now, I can easily
generate a string of the contents of the buffer, and call SCAN (or
whatever) on the string.  However, this is going to be slow for large
buffers (especially if we find something just after point, we've still
constructed the whole buffer-string).

The "obvious" solution to this is to use streams instead (probably),
so, I wonder if cl-ppcre would be amenable to something like this?

On another, somewhat unrelated note.  One thing that one would like to
do is regexp search and replace, now, if I know how many groups the
user is going to input into their regexp before the fact, I can use
REGISTER-GROUPS-BIND to get at the substring matches via variables.
I guess there isn't any way to do this without knowing the input
beforehand.  So is the idea then just to use SCAN and then manually
grab the substrings via REG-STARTS and REG-ENDS, or have I missed
something obvious?

Cheers,

Lawrence

--
Lawrence Mitchell <wencel at gmail.com>



More information about the Cl-ppcre-devel mailing list