emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 2075864: CC Mode: stop extra parens on expression


From: Alan Mackenzie
Subject: [Emacs-diffs] emacs-26 2075864: CC Mode: stop extra parens on expression causing false fontification as type
Date: Mon, 10 Dec 2018 09:40:27 -0500 (EST)

branch: emacs-26
commit 2075864c7717491f1156998120535ce72ed8f0cc
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    CC Mode: stop extra parens on expression causing false fontification as type
    
    * lisp/progmodes/cc-fonts.el (c-get-fontification-context): recognize
    arithmetic operator followed by several open parentheses, not just one, as 
not
    being an argument list.
---
 lisp/progmodes/cc-fonts.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index fa9b8f3..39d167f 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1279,12 +1279,14 @@ casts and declarations are fontified.  Used on level 2 
and higher."
           (c-put-char-property (1- match-pos)
                                'c-type 'c-decl-arg-start)
           (cons 'decl nil))
-         ;; Got an open paren preceded by an arith operator.
+         ;; Got (an) open paren(s) preceded by an arith operator.
          ((and (eq (char-before match-pos) ?\()
                (save-excursion
                  (goto-char match-pos)
-                 (and (zerop (c-backward-token-2 2))
-                      (looking-at c-arithmetic-op-regexp))))
+                 (while
+                     (progn (c-backward-token-2)
+                            (eq (char-after) ?\()))
+                 (looking-at c-arithmetic-op-regexp)))
           (cons nil nil))
          ;; In a C++ member initialization list.
          ((and (eq (char-before match-pos) ?,)



reply via email to

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