emacs-devel
[Top][All Lists]
Advanced

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

Re: AW: font-locking and open parens in column 0


From: martin rudalics
Subject: Re: AW: font-locking and open parens in column 0
Date: Sun, 12 Nov 2006 20:45:03 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> However, I did not realize that CC mode actually used that case.  I
> thought it had a beginning-of-defun-function.  I was surprised just
> now to see that it didn't have one.  Perhaps that should be changed.

I've been asking before why c-mode cannot use `c-beginning-of-defun'
here.  Is it because syntax-table properties haven't been set up?  I
recall invoking `c-beginning-of-defun' in arbitrary not yet fontified
text and getting strange results.

> However, taking out the use of syntax-ppss in beginning-of-defun-raw
> isn't the right way to get good behavior in CC mode.  That would only
> make it parse from the start of the file every time.

When scrolling through a buffer backwards, the current patch will cause
parsing from bob every time I scroll.

> (In any case, such a problem won't arise in Emacs Lisp mode, since
> open-paren-in-column-0-is-defun-start = t.)

`open-paren-in-column-0-is-defun-start' is a user option.

>     A reliable way to get behavior 1 is to use syntax-ppss rather than
>     beginning-of-defun.
>
> That is a good point.  Maybe some uses of beginning-of-defun
> (such as in Font Lock) ought to use syntax-ppss instead.

This would introduce a circular dependency since `syntax-ppss' may call
`beginning-of-defun'.

>     The proposed patch basically tries to make beginning-of-defun follow the
>     behavior number 1 and to make it do so reliably.
>
> I don't see it that way.

I see it Stefan's way.





reply via email to

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