emacs-devel
[Top][All Lists]
Advanced

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

Re: font-locking and open parens in column 0


From: Richard Stallman
Subject: Re: font-locking and open parens in column 0
Date: Sun, 05 Nov 2006 02:08:53 -0500

    CC Mode always sets o-p-i-c-0-i-d-start to nil, and caches the brace
    structure to prevent excessive scanning from BOB.  After all, opic0id
    being nil will always find BO-defun.  Setting it to t was an optimisation
    for when computers were much less powerful than they are now - and this
    causes quite a bit of inconvenience.

That optimization may still be important.  It is ok for CC mode to set
this to nil IF it provides another optimization which does the same
job.  For instance, using the cache.  If that makes the same
operations fast, then we don't need the paren-in-column-0
optimization.

There is some doubt about whether your cache is getting used
for all the operations that do this.

    >... which parallels the work of `syntax-ppss', hence we currently end up
    >with two caches for the same structures - I know c-mode has to work hard
    >to handle all sorts of older (X)Emacsen ...

    Not only that, CC Mode uses its cache for things other than font-locking.

Could CC mode use `syntax-ppss' for all those things?
If so, it could get rid of its own cache and rely on the
cache in `syntax-ppss'.

    >It does fix it, and it's even pretty fast ;-).  But I still think the
    >"bug" is with the author who put the left paren in column zero of that
    >comment.  That author should be warned just as in emacs-lisp-mode.

    Should _HAVE_ been warned.  Martin Stjernholm has worked very hard to
    remove that restriction from C Mode without sacrificing (much) speed.  It
    would be a shame now to leave the restriction in Emacs 22.

I agree that if CC mode is not confused by that paren in column 0
then there is no need to flag it for the user.




reply via email to

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