mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
* 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.
This commit is contained in:
parent
d8cd72025e
commit
26b8f810d0
2 changed files with 59 additions and 21 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue