Added freerdp-electric-identifier-character-regexp

Pascal J. Bourguignon [2018-06-18 12:31]
Added freerdp-electric-identifier-character-regexp
Filename
freerdp-c-style.el
diff --git a/freerdp-c-style.el b/freerdp-c-style.el
index aed08a2..7b244b2 100644
--- a/freerdp-c-style.el
+++ b/freerdp-c-style.el
@@ -555,13 +555,17 @@ unless -> in which case we remove the spaces."
                     (character (string string-designator)))
                 c-keywords-obarray))

+(defun freerdp-electric-special-character-p (ch)
+  (string-match "[[:punct:]]" (string ch)))
+
+(defvar freerdp-electric-identifier-character-regexp "[[:alnum:]_]")
+
 (defun freerdp-electric-paren-open (repeat)
   (interactive "p")
   (if (= 1 repeat)
       (progn
-        (if (and (looking-at "[[:alpha:]_]")
-                 (or (bolp)
-                     (spacep (char-before))))
+        (if (and (looking-at freerdp-electric-identifier-character-regexp)
+                 (looking-back freerdp-electric-identifier-character-regexp (- (point) 1)))
             (insert "()")
             (progn
               (freerdp-remove-previous-spaces)
ViewGit