aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/cc-mode.el
diff options
context:
space:
mode:
authorAlan Mackenzie <[email protected]>2006-07-20 09:48:09 +0000
committerAlan Mackenzie <[email protected]>2006-07-20 09:48:09 +0000
commit26b8f810d0ef4c002215a99f77de3625956c5607 (patch)
tree175c92220de600c0c5a762efa83beefe4869656b /lisp/progmodes/cc-mode.el
parentd8cd72025ef574a37ee51d6e9452cd7ce7a26633 (diff)
* progmodes/cc-langs.el (c-emacs-variable-inits): new variable.
(c-lang-setvar): new macro. (c-make-init-lang-vars-fun): Use the initialization forms in c-emacs-variable-inits in addition to those in c-lang-variable-inits. (comment-start, comment-end, comment-start-skip): Change these from c-lang-defvar's to c-lang-setvar's. * progmodes/cc-mode.el (c-make-emacs-variables-local): new macro, which calls make-local-variable on the elements of c-emacs-variable-inits. (c-init-language-vars-for): Call this new macro.
Diffstat (limited to 'lisp/progmodes/cc-mode.el')
-rw-r--r--lisp/progmodes/cc-mode.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 7343ec735e..eb5ae4b63b 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -153,12 +153,21 @@
(defun c-leave-cc-mode-mode ()
(setq c-buffer-is-cc-mode nil))
+;; 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
+ ,@(mapcan (lambda (init)
+ `((make-local-variable ',(car init))))
+ (cdr c-emacs-variable-inits))))
+
(defun c-init-language-vars-for (mode)
"Initialize the language variables for one of the language modes
directly supported by CC Mode. This can be used instead of the
`c-init-language-vars' macro if the language you want to use is one of
those, rather than a derived language defined through the language
variable system (see \"cc-langs.el\")."
+ (c-make-emacs-variables-local)
(cond ((eq mode 'c-mode) (c-init-language-vars c-mode))
((eq mode 'c++-mode) (c-init-language-vars c++-mode))
((eq mode 'objc-mode) (c-init-language-vars objc-mode))