From 05c123e62c476cbb856417823af0ba7bb59fa0c7 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sun, 20 Jun 2010 16:17:05 +0000 Subject: [PATCH] * progmodes/cc-mode.el (c-before-hack-hook): When the mode is set in file local variables, set it first. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/cc-mode.el | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3371fb45312..47763f3c705 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-20 Alan Mackenzie + + * progmodes/cc-mode.el (c-before-hack-hook): When the mode is set + in file local variables, set it first. + 2010-06-19 Glenn Morris * descr-text.el (describe-char-unicode-data): Insert separating diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 2bfa2b7df9b..6b0d3f8b423 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -662,8 +662,13 @@ They are set only when, respectively, the pseudo variables 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)) -- 2.39.2