From 26b8f810d0ef4c002215a99f77de3625956c5607 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 20 Jul 2006 09:48:09 +0000 Subject: * 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. --- lisp/progmodes/cc-mode.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lisp/progmodes/cc-mode.el') 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)) -- cgit v1.2.3