emacs-devel
[Top][All Lists]
Advanced

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

Re: Slow fontification in C mode buffers


From: Kan-Ru Chen
Subject: Re: Slow fontification in C mode buffers
Date: Fri, 16 Dec 2011 00:16:25 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> Would you please try the following patch and let me know how it goes.
> Thanks!

No change. c-cheap-inside-bracelist-p seems not called at all.

> *** orig/cc-engine.el 2011-12-15 09:06:28.000000000 +0000
> --- cc-engine.el      2011-12-15 13:41:25.000000000 +0000
> ***************
> *** 8073,8078 ****
> --- 8073,8094 ----
>           next-open-brace (c-pull-open-brace paren-state)))
>       open-brace))
>   
> + (defun c-cheap-inside-bracelist-p (paren-state)
> +   ;; Return the position of the L-brace if point is inside a brace list
> +   ;; initialization of an array, etc.  This is an approximate function,
> +   ;; designed for speed over accuracy.  We simply search for "= {" 
> (naturally
> +   ;; with syntactic whitespace allowed).  PAREN-STATE is the normal thing 
> that
> +   ;; it is everywhere else.
> +   (let (b-pos)
> +     (save-excursion
> +       (while
> +       (and (setq b-pos (c-pull-open-brace paren-state))
> +            (progn (goto-char b-pos)
> +                   (c-backward-sws)
> +                   (c-backward-token-2)
> +                   (not (looking-at "=")))))
> +       b-pos)))
> + 
>   (defun c-inside-bracelist-p (containing-sexp paren-state)
>     ;; return the buffer position of the beginning of the brace list
>     ;; statement if we're inside a brace list, otherwise return nil.
> *** orig/cc-fonts.el  2011-12-15 09:06:28.000000000 +0000
> --- cc-fonts.el       2011-12-15 13:15:43.000000000 +0000
> ***************
> *** 1394,1399 ****
> --- 1394,1405 ----
>             (c-fontify-recorded-types-and-refs)
>             nil)
>   
> +          ;; If point is inside a bracelist, there's no point checking it
> +          ;; being at a declarator.
> +          ((let ((paren-state (c-parse-state)))
> +             (c-cheap-inside-bracelist-p paren-state))
> +           nil)
> + 
>            (t
>             ;; Are we at a declarator?  Try to go back to the declaration
>             ;; to check this.  If we get there, check whether a "typedef"
>
>> -- 
>> Kanru

-- 
Kanru



reply via email to

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