emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/symbol-overlay 17cac32ea9 090/152: Added support to ignore


From: ELPA Syncer
Subject: [nongnu] elpa/symbol-overlay 17cac32ea9 090/152: Added support to ignore keywords from c and c++ modes
Date: Thu, 7 Jul 2022 12:04:17 -0400 (EDT)

branch: elpa/symbol-overlay
commit 17cac32ea96c272f3c210e2ea2ddc6ada93c37bd
Author: Leandro Cardoso <leandrocardoso@gmail.com>
Commit: Leandro Cardoso <leandrocardoso@gmail.com>

    Added support to ignore keywords from c and c++ modes
---
 symbol-overlay.el | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/symbol-overlay.el b/symbol-overlay.el
index 2252f0eb40..eedec9f639 100644
--- a/symbol-overlay.el
+++ b/symbol-overlay.el
@@ -152,7 +152,9 @@ You can add more colors whatever you like."
   :type 'float)
 
 (defcustom symbol-overlay-ignore-functions
-  '((python-mode . symbol-overlay-ignore-function-python))
+ '((c-mode . symbol-overlay-ignore-function-c)
+   (c++-mode . symbol-overlay-ignore-function-c++)
+   (python-mode . symbol-overlay-ignore-function-python))
   "Functions to determine whether a symbol should be ignored.
 
 This is an association list that maps a MAJOR-MODE symbol to a
@@ -365,6 +367,39 @@ If SHOW-COLOR is non-nil, display the color used by 
current overlay."
               (+ count 1)
               (+ count (length after))))))
 
+(defvar c-font-lock-extra-types)
+(defun symbol-overlay-ignore-function-c (symbol)
+  "Determine whether SYMBOL should be ignored (C Language)."
+  (let ((keywords (append c-font-lock-extra-types
+                  '("auto" "break" "case" "char" "const" "continue"
+                    "default" "do" "double" "else" "enum" "extern"
+                    "float" "for" "goto" "if" "inline" "int" "long"
+                    "register" "restrict" "return" "short" "signed"
+                    "sizeof" "static" "struct" "switch" "typedef"
+                    "union" "unsigned" "void" "volatile" "while"))))
+    (string-match-p (concat "\\_<\\(" (mapconcat 'identity keywords "\\|") 
"\\)\\_>") symbol)))
+
+(defvar c++-font-lock-extra-types)
+(defun symbol-overlay-ignore-function-c++ (symbol)
+  "Determine whether SYMBOL should be ignored (C++)."
+  (let ((keywords (append c++-font-lock-extra-types
+                  '("alignas" "alignof" "asm" "auto" "bool" "break"
+                    "case" "catch" "char" "char16_t" "char32_t" "class"
+                    "const" "const_cast" "constexpr" "continue"
+                    "decltype" "default" "delete" "do" "double"
+                    "dynamic_cast" "else" "enum" "explicit" "export"
+                    "extern" "false" "final" "float" "for" "friend"
+                    "goto" "if" "inline" "int" "long" "mutable"
+                    "namespace" "new" "noexcept" "nullptr" "operator"
+                    "override" "private" "protected" "public" "register"
+                    "reinterpret_cast" "return" "short" "signed"
+                    "sizeof" "static" "static_assert" "static_cast"
+                    "struct" "switch" "template" "this" "thread_local"
+                    "throw" "true" "try" "typedef" "typeid" "typename"
+                    "union" "unsigned" "using" "virtual" "void"
+                    "volatile" "wchar_t" "while"))))
+    (string-match-p (concat "\\_<\\(" (mapconcat 'identity keywords "\\|") 
"\\)\\_>") symbol)))
+
 (defvar python-font-lock-keywords)
 (defun symbol-overlay-ignore-function-python (symbol)
   "Determine whether SYMBOL should be ignored (Python)."



reply via email to

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