summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2019-01-22 14:37:54 +0000
committerAlan Mackenzie <acm@muc.de>2019-01-22 14:37:54 +0000
commit9eaf5e052a802a7b0560f983f2bb786e13ce2488 (patch)
treee89f066d7a0621e703df5b80eef9491278b2f612 /lisp/progmodes/cc-langs.el
parentf97b734ffb2b70f3d94e46453a236b46e0704901 (diff)
downloademacs-9eaf5e052a802a7b0560f983f2bb786e13ce2488.tar.gz
Extend electric-pair-mode actions to < and >, and also to ( and ) in literals
* lisp/progmodes/cc-cmds.el (c-electric-lt-gt): Actuate electric-pair-mode if a < or > is typed in a context where this is meaningful (#include, or template). (c-electric-paren): Allow electric-pair-mode activity in a comment or string. * lisp/progmodes/cc-defs.el (c-make-keywords-re): Fix a bug where lists of source symbols could get overwritten when parameter adorn is set to 'appendable. * list/progmodes/cc-langs.el (c-cpp-include-key): New lang const and var.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 4bd4914a2d7..53342713b4a 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -927,6 +927,19 @@ file name in angle brackets or quotes."
'("include"))
objc '("include" "import"))
+(c-lang-defconst c-cpp-include-key
+ ;; Matches an include directive anchored at BOL including any trailing
+ ;; whitespace, e.g. " # include "
+ t (if (and (c-lang-const c-anchored-cpp-prefix)
+ (c-lang-const c-cpp-include-directives))
+ (concat
+ (c-lang-const c-anchored-cpp-prefix)
+ (c-make-keywords-re 'appendable
+ (c-lang-const c-cpp-include-directives))
+ "[ \t]*")
+ "a\\`")) ; Doesn't match anything
+(c-lang-defvar c-cpp-include-key (c-lang-const c-cpp-include-key))
+
(c-lang-defconst c-opt-cpp-macro-define
"Cpp directive (without the prefix) that is followed by a macro
definition, or nil if the language doesn't have any."