[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r106822: Optimise font locking in lon
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r106822: Optimise font locking in long enum definitions. |
Date: |
Sun, 08 Jan 2012 12:49:44 +0000 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 106822
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Sun 2012-01-08 12:49:44 +0000
message:
Optimise font locking in long enum definitions.
modified:
lisp/ChangeLog
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-langs.el
lisp/progmodes/cc-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-01-07 20:00:56 +0000
+++ b/lisp/ChangeLog 2012-01-08 12:49:44 +0000
@@ -1,3 +1,12 @@
+2012-01-08 Alan Mackenzie <address@hidden>
+
+ Optimise font locking in long enum definitions.
+
+ * progmodes/cc-fonts.el (c-font-lock-declarations): Add an extra
+ arm to a cond form to handle enums.
+ * progmodes/cc-langs.el (c-enums-contain-decls): New lang variable.
+ * progmodes/cc-mode.el (c-font-lock-fontify-region): Correct a typo.
+
2012-01-07 Paul Eggert <address@hidden>
* files.el (move-file-to-trash): Preserve default file modes on error.
=== modified file 'lisp/progmodes/cc-fonts.el'
--- a/lisp/progmodes/cc-fonts.el 2012-01-05 09:46:05 +0000
+++ b/lisp/progmodes/cc-fonts.el 2012-01-08 12:49:44 +0000
@@ -1428,6 +1428,21 @@
(c-fontify-recorded-types-and-refs)
nil)
+ ((and (not c-enums-contain-decls)
+ ;; An optimisation quickly to eliminate scans of long enum
+ ;; declarations in the next cond arm.
+ (let ((paren-state (c-parse-state)))
+ (and
+ (numberp (car paren-state))
+ (save-excursion
+ (goto-char (car paren-state))
+ (c-backward-token-2)
+ (or (looking-at c-brace-list-key)
+ (progn
+ (c-backward-token-2)
+ (looking-at c-brace-list-key)))))))
+ t)
+
(t
;; Are we at a declarator? Try to go back to the declaration
;; to check this. If we get there, check whether a "typedef"
=== modified file 'lisp/progmodes/cc-langs.el'
--- a/lisp/progmodes/cc-langs.el 2012-01-05 09:46:05 +0000
+++ b/lisp/progmodes/cc-langs.el 2012-01-08 12:49:44 +0000
@@ -2938,6 +2938,12 @@
(consp (c-lang-const c-<>-arglist-kwds))))
(c-lang-defvar c-recognize-<>-arglists (c-lang-const c-recognize-<>-arglists))
+(c-lang-defconst c-enums-contain-decls
+ "Non-nil means that an enum structure can contain declarations."
+ t nil
+ java t)
+(c-lang-defvar c-enums-contain-decls (c-lang-const c-enums-contain-decls))
+
(c-lang-defconst c-recognize-paren-inits
"Non-nil means that parenthesis style initializers exist,
i.e. constructs like
=== modified file 'lisp/progmodes/cc-mode.el'
--- a/lisp/progmodes/cc-mode.el 2012-01-05 09:46:05 +0000
+++ b/lisp/progmodes/cc-mode.el 2012-01-08 12:49:44 +0000
@@ -1158,7 +1158,7 @@
;; Effectively advice around `font-lock-fontify-region' which extends the
;; region (BEG END), for example, to avoid context fontification chopping
;; off the start of the context. Do not do anything if it's already been
- ;; done (i.e. from and after-change fontification. An example (C++) where
+ ;; done (i.e. from an after-change fontification. An example (C++) where
;; this used to happen is this:
;;
;; template <typename T>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r106822: Optimise font locking in long enum definitions.,
Alan Mackenzie <=