]> git.eshelyaron.com Git - emacs.git/commitdiff
CC Mode: Optimize c-fontify-new-found-type and amend a debug spec
authorAlan Mackenzie <acm@muc.de>
Tue, 4 Oct 2022 16:19:33 +0000 (16:19 +0000)
committerAlan Mackenzie <acm@muc.de>
Tue, 4 Oct 2022 16:19:33 +0000 (16:19 +0000)
* lisp/progmodes/cc-fonts.el (c-fontify-new-found-type): Write the `face'
property directly, rather than removing `fontified' properties and letting
font-lock do the work.

* lisp/progmodes/cc-defs.el (cc-eval-when-compile): Amend the debug spec from
t to (&rest body), in line with the fix to bug #16184.

lisp/progmodes/cc-defs.el
lisp/progmodes/cc-fonts.el

index 77aa3e62bb1587964f27e6476a44c9fa0889fba4..4f1a08cfa060bc6735756ae91e9ff68da3ae239a 100644 (file)
@@ -125,7 +125,7 @@ The result of the body appears to the compiler as a quoted constant.
 
 This variant works around bugs in `eval-when-compile' in various
 \(X)Emacs versions.  See cc-defs.el for details."
-    (declare (indent 0) (debug t))
+    (declare (indent 0) (debug (&rest def-form)))
     (if c-inside-eval-when-compile
        ;; XEmacs 21.4.6 has a bug in `eval-when-compile' in that it
        ;; evaluates its body at macro expansion time if it's nested
index 8f930c5437704433296fb9d3faaae8ac8379f35d..2e71285cb36234b4d78d4d07d837ce37a5528604 100644 (file)
@@ -2479,8 +2479,12 @@ higher."
          (widen)
          (goto-char (point-min))
          (while (re-search-forward target-re nil t)
-           (put-text-property (match-beginning 0) (match-end 0)
-                              'fontified nil)
+           (when (and
+                  (get-text-property (match-beginning 0) 'fontified)
+                  (not (memq (c-get-char-property (match-beginning 0) 'face)
+                             c-literal-faces)))
+             (c-put-font-lock-face (match-beginning 0) (match-end 0)
+                                   font-lock-type-face))
            (dolist (win-boundary window-boundaries)
              (when (and (< (match-beginning 0) (cdr win-boundary))
                         (> (match-end 0) (car win-boundary))