[Top][All Lists]

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

Re: Mysterious fontification/C++ context issue - Patch for beginning-of-

From: martin rudalics
Subject: Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw.
Date: Sat, 16 Dec 2006 23:43:34 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> This idea seems to work fairly well.  The patch to syntax.c is
> attached; it adds an optional DEFUN_START argument to scan_lists which
> is a position known to be outside any code structure.  The code in
> beginning-of-defun-raw can be altered to use this as follows:
>   (let* ((ppss (let (syntax-begin-function
>                      font-lock-beginning-of-syntax-function)
>                  (syntax-ppss)))
>          (defun-start (nth 2 ppss))
>          ...)
>      ...
>     (goto-char (scan-lists (point) (- arg) 0 defun-start))
> With this additional change, (progn (goto-char (point-max)) (redisplay))
> on xdisp.c takes 0.139s, down from 2.15s.

This seems to prove that we have localized the bug.  The problem is,
however, that scan-lists is probably used in too many places and you
would reliably have to find the defun-start for each and every of them.

> However M-> is still slow, because, for some reason, (recenter -3) at
> the end of the buffer now takes about 2 seconds.  I don't know why.

Probably because somewhere scan-lists is called without the appropriate

> However, I think all this should be post-22 work; for Emacs 22, let's
> just set open-paren-in-column-0-is-defun-start to t, and leave the
> existing beginning-of-defun-raw code there should anyone want to set
> it to nil.

I agree.  More so, because, as I stated earlier, editing C code on my
system has become painstakingly slow for more than a year.  The recent
change to `beginning-of-defun-raw' was apparently just the straw
breaking the camel's back.

reply via email to

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