[Top][All Lists]

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

Re: font-locking and open parens in column 0

From: martin rudalics
Subject: Re: font-locking and open parens in column 0
Date: Sat, 04 Nov 2006 10:30:09 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>> 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.

Which means that Martin Stjernholm's change did not make it to
font-locking which, for c-mode, still uses the `beginning-of-defun' from
lisp-mode.  I see only two reasonable fixes to this:

(1) Set `syntax-begin-function' (or `beginning-of-defun-function') to
    `c-beginning-of-defun' if you trust that change.  This should,
    hopefully, populate your cache.

(2) Set `syntax-begin-function' to nil as Stefan suggested and let
    `syntax-ppss' do the work.  This should populate Stefan's cache.

Any other solution would be a shameful waste of resources since the
results of `parse-partial-sexp' from your original proposal don't get
stored anywhere (jumping to a position n in a c-mode buffer and
subsequently jumping to a position m < n would afford to rescan from
bob).  Also make sure that `font-lock-beginning-of-syntax-function'
nowhere interferes with these settings.

Ideally, there would be one and only one cache populated and consulted
by both - c-mode and `syntax-ppss'.

reply via email to

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