emacs-devel
[Top][All Lists]
Advanced

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

Re: outline/allout/overlay performance


From: Ken Manheimer
Subject: Re: outline/allout/overlay performance
Date: Thu, 12 Jan 2006 17:40:48 -0500

i've made the transition to directly using outline-flag-region from
allout mode (rather than allout having it's own allout-flag-region),
and am using outline-flag-region as it stands.  to enable allout's
custom isearch-open-invisible behavior, i'm defadvicing
`outline-isearch-open-invisible' (which is what outline-flag-regexp
assigns as the isearch-open-invisible property on the overlays) so
that allout's preferred function, `allout-show-to-offshoot' is run,
instead, when the outline is in allout-mode.  this works very nicely!

more generally, i'm getting the distinct impression that there are
more than a few generalization issues in this suppression-of-detail
reveal/conceal realm, that (2) deserve comprehensive attention, and
(2) are of scope well beyond the particular things i have time for at
the moment.

that said, i do have some responses to your particular suggestions.

On 1/11/06, Stefan Monnier <address@hidden> wrote:

> > the function is registered with the overlay, as a property - that's
> > why the current outline-flag-region sets it.  i want to make the
> > function it registers with the overlay parameterized - eg, a mode
> > local variable - to be registered if set.  outline-mode's current one
> > (`outline-isearch-open-invisible') will be used for outline-mode, and
> > allout will have its own.  other modes could, too.
>
> Actually, some other modes using similar functions add a few more
> properties, so I think it makes sense to just add a &rest parameter to
> outline-flag-region.

i don't like the idea of having every call to outline-flag-region pass
in generic mode parameters every time the function is called.  such
incidental concerns can pile up, obscuring the specific business
relevant to the actual call, complicating programmers lives with
incidental things to remember in every call.

i don't know the exact right mechanism to use for such concerns, but
hook-function lists seem like the kind of thing - though we're
probably talking about things that belong in particular modes.  that
suggests properties on some hook variable, qualified with the mode
where they belong or put in an 'all' bucket if they want to be used
everywhere.

> As for using a buffer-local variable for outline-isearch-open-invisible, it
> assumes only one major/minor mode will use it at a time.  In reveal.el
> I chose to allow a reveal-toggle-invisible property on the overlay or on the
> symbol used for invisibility.  So in outline.el rather than adding the
> property to every single overlay, I just do
>
>   (put 'outline 'reveal-toggle-invisible 'outline-reveal-toggle-invisible)
>
> and reveal.el finds it with
>
>   (get (overlay-get ol 'invisible) 'reveal-toggle-invisible)
>
> Maybe isearch (c|sh)ould be changed in a similar way.

this sounds good - i may be describing something like it, above.

> >> stitches overlays together sounds like a good idea.
> >> Maybe it could be made into a generic function, much like remove-overlays
> >> and moved to subr.el.
> > i'll take a look at remove-overlays, when i get to that point.
>
> All I was thinking is to add a function like
>
>     (add-overlay-props FROM TO &rest PROPS)
>
> which either creates a new overlay with the specified props or moves
> existing overlays if there's already an overlay around with the right
> properties, thus trying to minimize the number of overlays in the buffer.
> This said, it's probably more important to work on the C code to try and
> remove the O(n) behavior.  And even if it's not removed everywhere, I can't
> think of any reason why cursor movement should suffer from this
> O(n) behavior.

fortunately, it doesn't look like overlays need that consolidation.  i
don't know how they're implemented, but it seems like they
"consolidated" on their own.

i thank you (and everyone else who've provided clues) for helping
guide me.  i think i have a good approach at this point - the advice
mechnism scales, since others can similarly advice-wrap as needed.  it
depends on continuing use of the particular
outline-isearch-open-invisible function, but any approach is going to
establish some such dependencies...

ken
address@hidden




reply via email to

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