emacs-diffs
[Top][All Lists]
Advanced

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

master a42f4a775ba: CC Mode: Fix fontification problems shown by test fi


From: Alan Mackenzie
Subject: master a42f4a775ba: CC Mode: Fix fontification problems shown by test file templates-20.cc
Date: Wed, 5 Apr 2023 09:05:02 -0400 (EDT)

branch: master
commit a42f4a775bab61581d6b8dbd4fe2eeab55a6ea31
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    CC Mode: Fix fontification problems shown by test file templates-20.cc
    
    Also fix one problem evident in test file decls-10.cc.
    
    * lisp/progmodes/cc-engine.el (c-brace-stack-at): Bind
    c-record-type-identifiers to nil to prevent called functions recording
    identifiers spuriously.
    (c-forward-<>-arglist-recur): Revert the ill-advised optimization from 
autumn
    2022 which attempted to avoid re-marking c-type text properties inside angle
    bracket arglists.
    (c-forward-decl-or-cast-1): Accept the semicolon at the end of "t8 * id;" as
    sufficient evidence to fontify as a declaration (not a multiplication).
    
    * lisp/progmodes/cc-fonts.el (c-font-lock-c++-using): No longer fontify the
    last component of foo::bar with c-reference-face-name.
---
 lisp/progmodes/cc-engine.el | 24 +++++++++++-------------
 lisp/progmodes/cc-fonts.el  |  4 +---
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 81446c3c00b..fe9e62ee569 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -146,11 +146,6 @@
 ;;   "typedef" keyword.  It's value is a list of the identifiers that
 ;;   the "typedef" declares as types.
 ;;
-;; 'c-<>-c-types-set
-;;   This property is set on an opening angle bracket, and indicates that
-;;   any "," separators within the template/generic expression have been
-;;   marked with a 'c-type property value 'c-<>-arg-sep (see above).
-;;
 ;; 'c-awk-NL-prop
 ;;   Used in AWK mode to mark the various kinds of newlines.  See
 ;;   cc-awk.el.
@@ -6172,12 +6167,18 @@ comment at the start of cc-engine.el for more info."
       (cons (point)
            (cons bound-<> s)))))
 
+(defvar c-record-type-identifiers)     ; Specially for `c-brace-stack-at'.
+
 (defun c-brace-stack-at (here)
   ;; Given a buffer position HERE, Return the value of the brace stack there.
   (save-excursion
     (save-restriction
       (widen)
-      (let ((c c-bs-cache)
+      (let (c-record-type-identifiers  ; In case `c-forward-<>-arglist' would
+                                       ; otherwise record identifiers outside
+                                       ; of the restriction in force before
+                                       ; this function.
+           (c c-bs-cache)
            (can-use-prev (<= c-bs-prev-pos c-bs-cache-limit))
            elt stack pos npos high-elt)
        ;; Trim the cache to take account of buffer changes.
@@ -8630,11 +8631,9 @@ multi-line strings (but not C++, for example)."
        ;; List that collects the positions after the argument
        ;; separating ',' in the arglist.
        arg-start-pos)
-    ;; If the '<' has paren open syntax then we've marked it as an angle
-    ;; bracket arglist before, so skip to the end.
-    (if (and syntax-table-prop-on-<
-            (or (not c-parse-and-markup-<>-arglists)
-                (c-get-char-property (point) 'c-<>-c-types-set)))
+    (if (and (not c-parse-and-markup-<>-arglists)
+            syntax-table-prop-on-<)
+
        (progn
          (forward-char)
          (if (and (c-go-up-list-forward)
@@ -8731,7 +8730,6 @@ multi-line strings (but not C++, for example)."
                               (c-unmark-<->-as-paren (point)))))
                      (c-mark-<-as-paren start)
                      (c-mark->-as-paren (1- (point)))
-                     (c-put-char-property start 'c-<>-c-types-set t)
                      (c-truncate-lit-pos-cache start))
                    (setq res t)
                    nil))               ; Exit the loop.
@@ -11200,7 +11198,7 @@ This function might do hidden buffer changes."
                 ;; declaration.
                 (setq maybe-expression t)
                 (when (or (not c-asymmetry-fontification-flag)
-                          (looking-at "=[^=]")
+                          (looking-at "=\\([^=]\\|$\\)\\|;")
                           (c-fdoc-assymetric-space-about-asterisk))
                   (when (eq at-type 'maybe)
                     (setq unsafe-maybe t))
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index f726fef467e..17b3c7be199 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -2678,9 +2678,7 @@ need for `c-font-lock-extra-types'.")
                           'same)
                       (looking-at c-colon-type-list-re)))
                ;; Inherited protected member: leave unfontified
-               )
-              (t (goto-char pos)
-                 (c-font-lock-declarators limit nil c-label-face-name nil)))
+               ))
              (eq (char-after) ?,)))
        (forward-char)))                ; over the comma.
     nil))



reply via email to

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