aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2007-07-28 11:45:55 +0000
committerAlan Mackenzie2007-07-28 11:45:55 +0000
commit473944f358e47b45f92e8cc88444f42ffdbb49e9 (patch)
tree87c6107616a0341f377f818b89c82943c314738a
parent2cd3efd277123b5109d912864b4b6673f40f3b98 (diff)
downloademacs-473944f358e47b45f92e8cc88444f42ffdbb49e9.tar.gz
emacs-473944f358e47b45f92e8cc88444f42ffdbb49e9.zip
Fix problem with modes derived from CC Mode: Move macro
`c-make-emacs-variables-local' from cc-mode.el to cc-langs.el. Call it from c-make-init-lang-vars-fun (cc-langs.el) instead of c-init-language-vars-for (cc-mode.el).
-rw-r--r--lisp/progmodes/cc-langs.el10
-rw-r--r--lisp/progmodes/cc-mode.el9
2 files changed, 10 insertions, 9 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."
2875(defconst c-lang-variable-inits (cc-eval-when-compile c-lang-variable-inits)) 2875(defconst c-lang-variable-inits (cc-eval-when-compile c-lang-variable-inits))
2876(defconst c-emacs-variable-inits (cc-eval-when-compile c-emacs-variable-inits)) 2876(defconst c-emacs-variable-inits (cc-eval-when-compile c-emacs-variable-inits))
2877 2877
2878;; Make the `c-lang-setvar' variables buffer local in the current buffer.
2879;; These are typically standard emacs variables such as `comment-start'.
2880(defmacro c-make-emacs-variables-local ()
2881 `(progn
2882 ,@(mapcar (lambda (init)
2883 `(make-local-variable ',(car init)))
2884 (cdr c-emacs-variable-inits))))
2885
2878(defun c-make-init-lang-vars-fun (mode) 2886(defun c-make-init-lang-vars-fun (mode)
2879 "Create a function that initializes all the language dependent variables 2887 "Create a function that initializes all the language dependent variables
2880for the given mode. 2888for the given mode.
@@ -2898,6 +2906,7 @@ accomplish that conveniently."
2898 ;; that could be in the result from `cl-macroexpand-all'. 2906 ;; that could be in the result from `cl-macroexpand-all'.
2899 (let ((c-buffer-is-cc-mode ',mode) 2907 (let ((c-buffer-is-cc-mode ',mode)
2900 current-var source-eval) 2908 current-var source-eval)
2909 (c-make-emacs-variables-local)
2901 (condition-case err 2910 (condition-case err
2902 2911
2903 (if (eq c-version-sym ',c-version-sym) 2912 (if (eq c-version-sym ',c-version-sym)
@@ -2956,6 +2965,7 @@ accomplish that conveniently."
2956 (init (append (cdr c-emacs-variable-inits) 2965 (init (append (cdr c-emacs-variable-inits)
2957 (cdr c-lang-variable-inits))) 2966 (cdr c-lang-variable-inits)))
2958 current-var) 2967 current-var)
2968 (c-make-emacs-variables-local)
2959 (condition-case err 2969 (condition-case err
2960 2970
2961 (while init 2971 (while init
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index f201f9bab6c..8669a41c2f0 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -154,21 +154,12 @@
154(defun c-leave-cc-mode-mode () 154(defun c-leave-cc-mode-mode ()
155 (setq c-buffer-is-cc-mode nil)) 155 (setq c-buffer-is-cc-mode nil))
156 156
157;; Make the `c-lang-setvar' variables buffer local in the current buffer.
158;; These are typically standard emacs variables such as `comment-start'.
159(defmacro c-make-emacs-variables-local ()
160 `(progn
161 ,@(mapcar (lambda (init)
162 `(make-local-variable ',(car init)))
163 (cdr c-emacs-variable-inits))))
164
165(defun c-init-language-vars-for (mode) 157(defun c-init-language-vars-for (mode)
166 "Initialize the language variables for one of the language modes 158 "Initialize the language variables for one of the language modes
167directly supported by CC Mode. This can be used instead of the 159directly supported by CC Mode. This can be used instead of the
168`c-init-language-vars' macro if the language you want to use is one of 160`c-init-language-vars' macro if the language you want to use is one of
169those, rather than a derived language defined through the language 161those, rather than a derived language defined through the language
170variable system (see \"cc-langs.el\")." 162variable system (see \"cc-langs.el\")."
171 (c-make-emacs-variables-local)
172 (cond ((eq mode 'c-mode) (c-init-language-vars c-mode)) 163 (cond ((eq mode 'c-mode) (c-init-language-vars c-mode))
173 ((eq mode 'c++-mode) (c-init-language-vars c++-mode)) 164 ((eq mode 'c++-mode) (c-init-language-vars c++-mode))
174 ((eq mode 'objc-mode) (c-init-language-vars objc-mode)) 165 ((eq mode 'objc-mode) (c-init-language-vars objc-mode))