comparison lisp/progmodes/cc-mode.el @ 72031:2b53c13e6121

* 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.
author Alan Mackenzie <acm@muc.de>
date Thu, 20 Jul 2006 09:48:09 +0000
parents 60304f6ae360
children cf3e4c6cd4c3 858cb33ae39d
comparison
equal deleted inserted replaced
72030:b0477954803b 72031:2b53c13e6121
151 ;; derived-mode-ex.el>. 151 ;; derived-mode-ex.el>.
152 152
153 (defun c-leave-cc-mode-mode () 153 (defun c-leave-cc-mode-mode ()
154 (setq c-buffer-is-cc-mode nil)) 154 (setq c-buffer-is-cc-mode nil))
155 155
156 ;; Make the `c-lang-setvar' variables buffer local in the current buffer.
157 ;; These are typically standard emacs variables such as `comment-start'.
158 (defmacro c-make-emacs-variables-local ()
159 `(progn
160 ,@(mapcan (lambda (init)
161 `((make-local-variable ',(car init))))
162 (cdr c-emacs-variable-inits))))
163
156 (defun c-init-language-vars-for (mode) 164 (defun c-init-language-vars-for (mode)
157 "Initialize the language variables for one of the language modes 165 "Initialize the language variables for one of the language modes
158 directly supported by CC Mode. This can be used instead of the 166 directly supported by CC Mode. This can be used instead of the
159 `c-init-language-vars' macro if the language you want to use is one of 167 `c-init-language-vars' macro if the language you want to use is one of
160 those, rather than a derived language defined through the language 168 those, rather than a derived language defined through the language
161 variable system (see \"cc-langs.el\")." 169 variable system (see \"cc-langs.el\")."
170 (c-make-emacs-variables-local)
162 (cond ((eq mode 'c-mode) (c-init-language-vars c-mode)) 171 (cond ((eq mode 'c-mode) (c-init-language-vars c-mode))
163 ((eq mode 'c++-mode) (c-init-language-vars c++-mode)) 172 ((eq mode 'c++-mode) (c-init-language-vars c++-mode))
164 ((eq mode 'objc-mode) (c-init-language-vars objc-mode)) 173 ((eq mode 'objc-mode) (c-init-language-vars objc-mode))
165 ((eq mode 'java-mode) (c-init-language-vars java-mode)) 174 ((eq mode 'java-mode) (c-init-language-vars java-mode))
166 ((eq mode 'idl-mode) (c-init-language-vars idl-mode)) 175 ((eq mode 'idl-mode) (c-init-language-vars idl-mode))