summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 9c749c11b6a..c5d9c162520 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2875,6 +2875,14 @@ way."
(defconst c-lang-variable-inits (cc-eval-when-compile c-lang-variable-inits))
(defconst c-emacs-variable-inits (cc-eval-when-compile c-emacs-variable-inits))
+;; Make the `c-lang-setvar' variables buffer local in the current buffer.
+;; These are typically standard emacs variables such as `comment-start'.
+(defmacro c-make-emacs-variables-local ()
+ `(progn
+ ,@(mapcar (lambda (init)
+ `(make-local-variable ',(car init)))
+ (cdr c-emacs-variable-inits))))
+
(defun c-make-init-lang-vars-fun (mode)
"Create a function that initializes all the language dependent variables
for the given mode.
@@ -2898,6 +2906,7 @@ accomplish that conveniently."
;; that could be in the result from `cl-macroexpand-all'.
(let ((c-buffer-is-cc-mode ',mode)
current-var source-eval)
+ (c-make-emacs-variables-local)
(condition-case err
(if (eq c-version-sym ',c-version-sym)
@@ -2956,6 +2965,7 @@ accomplish that conveniently."
(init (append (cdr c-emacs-variable-inits)
(cdr c-lang-variable-inits)))
current-var)
+ (c-make-emacs-variables-local)
(condition-case err
(while init