[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slow fontification in C mode buffers
From: |
Alan Mackenzie |
Subject: |
Re: Slow fontification in C mode buffers |
Date: |
Thu, 15 Dec 2011 13:43:32 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hello mk.4 Kanru.
On Tue, Dec 13, 2011 at 11:31:36PM +0800, Kan-Ru Chen wrote:
> Alan Mackenzie <address@hidden> writes:
> > By a happy coincidence, I've just tracked down another sluggishness (in
> > large array initialisations, reported by Peter Milliken on bug-cc-mode)
> > which looks to have exactly the same cause, namely
> > `c-font-lock-enclosing-decls' which fontifies the innards of a
> > struct/union/enum when jit-lock etc. starts in the middle of it.
> Is this the same problem?
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10288
> I cannot find the original report by Peter.
Would you please try the following patch and let me know how it goes.
Thanks!
*** 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
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Slow fontification in C mode buffers, (continued)
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/03
- Re: Slow fontification in C mode buffers, Eli Zaretskii, 2011/12/03
- Re: Slow fontification in C mode buffers, Kan-Ru Chen, 2011/12/13
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/14
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/14
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/14
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/14
- Re: Slow fontification in C mode buffers, Kan-Ru Chen, 2011/12/14
- Re: Slow fontification in C mode buffers,
Alan Mackenzie <=
- Re: Slow fontification in C mode buffers, Kan-Ru Chen, 2011/12/15
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/15
- Re: Slow fontification in C mode buffers, Kan-Ru Chen, 2011/12/15
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/16
- Re: Slow fontification in C mode buffers, Kan-Ru Chen, 2011/12/17
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/21
- Re: Slow fontification in C mode buffers, Geoff Gole, 2011/12/21
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/21
- Re: Slow fontification in C mode buffers, Geoff Gole, 2011/12/21
- Re: Slow fontification in C mode buffers, Alan Mackenzie, 2011/12/21