emacs-devel
[Top][All Lists]
Advanced

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

Re: C Mode: acceleration in brace deserts.


From: Lennart Borgman
Subject: Re: C Mode: acceleration in brace deserts.
Date: Thu, 3 Dec 2009 18:22:02 +0100

Hi Alan,

On Thu, Dec 3, 2009 at 5:59 PM, Alan Mackenzie <address@hidden> wrote:
> Hi, Lennart!
>
> On Thu, Dec 03, 2009 at 05:26:57PM +0100, Lennart Borgman wrote:
>> Hi Alan,
>
>> Can you tell me how the cache [c-parse-state] is implemented so I can
>> support it in MuMaMo?
>
> Short brusque answer: no - it's ~1300 lines of code, much of it arcane.


I need only a very short answer. I need to know how you store this
data so I do not destroy it when switching major mode in MuMaMo.

In the current situation I can only try to do that since the different
major modes may stamp on each other (I need some more Emacs support to
avoid that). But I can try. In some situations it is needed (for
example php may be split up in several parts (which html code between)
where the indentation in the next part should be aligned to that in
the prev part).

If you store it in a buffer local variable I am happy since all I have
to do then is to make that survive major mode switching. If you store
it in text properties I will be a bit more sad.


> Slightly longer answer: The cache's structure is a list of the positions
> of each successively enclosing brace/bracket/paren from point going back
> to the top level.  Additionally, if there is a brace pair preceding such
> a b/b/p, it is recorded as a cons.  Also there is a "good position", a
> position where the cache is known to be valid.
>
> When c-state-cache is called from a new position, the cache is usually
> updated rather than being calculated from scratch.  The involves
> removing entries from the cache which are now later than point, removing
> other entries which aren't relevant, since they've been "closed off",
> etc. - then scanning forward pairs of parens at a time successively
> entering deeper levels (see `c-append-to-state-cache').  Lots of dirty
> tricks are used to speed up the process as much as possible.
>
> Sorry I can't be more help, here.  But if you've any specific questions,
> let me know.
>
>> Best wishes,
>> L
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>




reply via email to

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