branch: scratch/editorconfig-cc
commit a6ab681950f97211f201ca96315fee7f7375adfc
Author: Hong Xu <h...@topbug.net>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    Apply settings on major mode change
---
 editorconfig.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index 3b9d408352..64909c0052 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -216,11 +216,12 @@ NOTE: Only the **buffer local** value of VARIABLE will be 
set."
   "Toggle EditorConfig feature."
   :global t
   :lighter ""
-  (if editorconfig-mode
-    (add-hook 'find-file-hook
-      'editorconfig-apply)
-    (remove-hook 'find-file-hook
-      'editorconfig-apply)))
+  (dolist (hook (list
+                  'find-file-hook
+                  'after-change-major-mode-hook))
+    (if editorconfig-mode
+      (add-hook hook 'editorconfig-apply)
+      (remove-hook hook 'editorconfig-apply))))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("/\\.editorconfig\\'" . conf-unix-mode))

Reply via email to