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

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

[nongnu] elpa/symbol-overlay 4885b028ee 098/152: Add support to ignore k


From: ELPA Syncer
Subject: [nongnu] elpa/symbol-overlay 4885b028ee 098/152: Add support to ignore keywords in go-mode
Date: Thu, 7 Jul 2022 12:04:18 -0400 (EDT)

branch: elpa/symbol-overlay
commit 4885b028ee595861e7d47cfbcf33c5ce054a30c1
Author: Daniel Kraus <daniel@kraus.my>
Commit: Daniel Kraus <daniel@kraus.my>

    Add support to ignore keywords in go-mode
---
 symbol-overlay.el | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/symbol-overlay.el b/symbol-overlay.el
index e63a5f2f54..ac6a99c349 100644
--- a/symbol-overlay.el
+++ b/symbol-overlay.el
@@ -77,6 +77,7 @@
 
 ;;; Code:
 
+(require 'cl-lib)
 (require 'thingatpt)
 (require 'seq)
 
@@ -138,9 +139,10 @@
   :type 'float)
 
 (defcustom symbol-overlay-ignore-functions
- '((c-mode . symbol-overlay-ignore-function-c)
-   (c++-mode . symbol-overlay-ignore-function-c++)
-   (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)
+    (go-mode . symbol-overlay-ignore-function-go))
   "Functions to determine whether a symbol should be ignored.
 
 This is an association list that maps a MAJOR-MODE symbol to a
@@ -395,6 +397,17 @@ If SHOW-COLOR is non-nil, display the color used by 
current overlay."
                     (symbol-name keyword-symbol))))
     (string-match-p keyword symbol)))
 
+(defvar go-builtins)
+(defvar go-constants)
+(defvar go-mode-keywords)
+(defun symbol-overlay-ignore-function-go (symbol)
+  "Determine whether SYMBOL should be ignored (Go)."
+  ;; Remove \_< and \_> so we can string compare with keywords
+  (let ((symbol (substring symbol 3 -3) ))
+    (or (cl-find symbol go-builtins :test #'string=)
+        (cl-find symbol go-constants :test #'string=)
+        (cl-find symbol go-mode-keywords :test #'string=))))
+
 ;;;###autoload
 (defun symbol-overlay-put ()
   "Toggle all overlays of symbol at point."



reply via email to

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