branch: scratch/editorconfig-cc
commit f3d6ecd644e9657690f9350c1cc929cf9454d642
Author: 10sr <8.slas...@gmail.com>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    Fix editorconfig-major-mode-hook (#260)
---
 editorconfig.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index a5a742485c..1b77b38947 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -590,7 +590,9 @@ any of regexps in `editorconfig-exclude-regexps'."
   "Function to run when `major-mode' has been changed.
 
 This functions does not reload .editorconfig file, just sets local variables
-again.  Changing major mode can reset these variables."
+again.  Changing major mode can reset these variables.
+
+This function also executes `editorconfig-after-apply-functions' functions."
   (display-warning '(editorconfig editorconfig-major-mode-hook)
                    (format "editorconfig-mode: %S, major-mode: %S, 
-properties-hash: %S"
                            (and (boundp 'editorconfig-mode)
@@ -601,7 +603,13 @@ again.  Changing major mode can reset these variables."
   (when (and (boundp 'editorconfig-mode)
              editorconfig-mode
              editorconfig-properties-hash)
-    (editorconfig-set-local-variables editorconfig-properties-hash)))
+    (editorconfig-set-local-variables editorconfig-properties-hash)
+    (condition-case err
+        (run-hook-with-args 'editorconfig-after-apply-functions 
editorconfig-properties-hash)
+      (error
+       (display-warning '(editorconfig editorconfig-major-mode-hook)
+                        (format "Error while running 
`editorconfig-after-apply-functions': %S"
+                                err))))))
 
 (defvar editorconfig--cons-filename-codingsystem nil
   "Used interally.

Reply via email to