diff lisp/progmodes/cc-mode.el @ 109249:452ecb3f69c0

* progmodes/cc-mode.el (c-before-hack-hook): When the mode is set in file local variables, set it first.
author Alan Mackenzie <acm@muc.de>
date Sun, 20 Jun 2010 16:17:05 +0000
parents 1a9d5fee61d1
children 60516122d066 376148b31b5e
line wrap: on
line diff
--- a/lisp/progmodes/cc-mode.el	Sat Jun 19 15:43:47 2010 -0400
+++ b/lisp/progmodes/cc-mode.el	Sun Jun 20 16:17:05 2010 +0000
@@ -662,8 +662,13 @@
 
 This function is called from the hook `before-hack-local-variables-hook'."
   (when c-buffer-is-cc-mode
-    (let ((stile (cdr (assq 'c-file-style file-local-variables-alist)))
+    (let ((mode-cons (assq 'mode file-local-variables-alist))
+	  (stile (cdr (assq 'c-file-style file-local-variables-alist)))
 	  (offsets (cdr (assq 'c-file-offsets file-local-variables-alist))))
+      (when mode-cons
+	(hack-one-local-variable (car mode-cons) (cdr mode-cons))
+	(setq file-local-variables-alist
+	      (delq mode-cons file-local-variables-alist)))
       (when stile
 	(or (stringp stile) (error "c-file-style is not a string"))
 	(c-set-style stile))