aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/cc-mode.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index f92d3efdeb7..e3a924efb06 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -2541,13 +2541,21 @@ Key bindings:
2541 2541
2542(defconst c-or-c++-mode--regexp 2542(defconst c-or-c++-mode--regexp
2543 (eval-when-compile 2543 (eval-when-compile
2544 (let ((id "[a-zA-Z0-9_]+") (ws "[ \t\r]+") (ws-maybe "[ \t\r]*")) 2544 (let ((id "[a-zA-Z_][a-zA-Z0-9_]*") (ws "[ \t\r]+") (ws-maybe "[ \t\r]*")
2545 (headers '("string" "string_view" "iostream" "map" "unordered_map"
2546 "set" "unordered_set" "vector" "tuple")))
2545 (concat "^" ws-maybe "\\(?:" 2547 (concat "^" ws-maybe "\\(?:"
2546 "using" ws "\\(?:namespace" ws "std;\\|std::\\)" 2548 "using" ws "\\(?:namespace" ws
2547 "\\|" "namespace" "\\(:?" ws id "\\)?" ws-maybe "{" 2549 "\\|" id "::"
2548 "\\|" "class" ws id ws-maybe "[:{\n]" 2550 "\\|" id ws-maybe "=\\)"
2549 "\\|" "template" ws-maybe "<.*>" 2551 "\\|" "\\(?:inline" ws "\\)?namespace"
2550 "\\|" "#include" ws-maybe "<\\(?:string\\|iostream\\|map\\)>" 2552 "\\(:?" ws "\\(?:" id "::\\)*" id "\\)?" ws-maybe "{"
2553 "\\|" "class" ws id
2554 "\\(?:" ws "final" "\\)?" ws-maybe "[:{;\n]"
2555 "\\|" "struct" ws id "\\(?:" ws "final" ws-maybe "[:{\n]"
2556 "\\|" ws-maybe ":\\)"
2557 "\\|" "template" ws-maybe "<.*?>"
2558 "\\|" "#include" ws-maybe "<" (regexp-opt headers) ">"
2551 "\\)"))) 2559 "\\)")))
2552 "A regexp applied to C header files to check if they are really C++.") 2560 "A regexp applied to C header files to check if they are really C++.")
2553 2561
@@ -2563,6 +2571,7 @@ should be used.
2563This function attempts to use file contents to determine whether 2571This function attempts to use file contents to determine whether
2564the code is C or C++ and based on that chooses whether to enable 2572the code is C or C++ and based on that chooses whether to enable
2565`c-mode' or `c++-mode'." 2573`c-mode' or `c++-mode'."
2574 (interactive)
2566 (if (save-excursion 2575 (if (save-excursion
2567 (save-restriction 2576 (save-restriction
2568 (save-match-data 2577 (save-match-data