map-extents, etc. What is the order of extents in these functions?
Alan Mackenzie
acm at muc.de
Thu Mar 11 03:02:00 EST 2010
On Wed, Mar 10, 2010 at 10:13:35AM +0100, Didier Verna wrote:
> Alan Mackenzie <acm at muc.de> wrote:
> > This is my first post on this list.
> Welcome!
> > I've got buffer positions marked by single-character extents. I need
> > to search forward for the next one, and backwards to the previous one.
> Why extents ? Wouldn't makers be simpler to use?
These extents have syntax-table properties, which are used by syntax
routines like parse-partial-sexp. For example, this is used to mark <
and > as template delimiters in C++ Mode.
> > It would be nice to use map-extents for the forward version here. Can
> > I assume that map-extents processes extents in "display order"? The
> > doc string and the fine manual forget to mention this.
> This comment from extents.c might be of some help:
> Extents are compared using memory indices. There are two orderings
> for extents and both orders are kept current at all times. The normal
> or "display" order is as follows:
[ .... ]
Thanks! That description of the display order is indeed interesting.
But is this the invariable order of extents used in map-extents? Or is
this order used sometimes, even most times, and some other order some
other times? This seems important. Why is it not said in the doc
string?
I could step through characters one by one in the buffer, testing each
for a pertinent extent until I find one. I don't want to have to do
this, though - I would rather use a slicker and more optimised API.
> > For the backward version, is there a way I could persuade a mapping
> > function to process the extents in inverse order ("e-display order",
> > I think it's called)?
> I may be wrong, but I think that mapcar-extents determines the order
> in which to map the extents according to the order in which you specify
> the FROM and TO arguments; i.e. you can use FROM > TO to get e-order.
Are you saying I can be sure of getting display order by using FROM < TO?
> But I think you should check for yourself by creating 2 dummy extents
> in a dummy buffer and see what gives.
Or maybe I need to go through the source code for map-extents. But I'd
rather not have to do that either - it's not much fun.
--
Alan Mackenzie (Nuremberg, Germany).
More information about the XEmacs-Beta
mailing list