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

    Add variable -hack-properties-functions
---
 editorconfig.el | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/editorconfig.el b/editorconfig.el
index bfd74671ad..6dd4ae0068 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -114,6 +114,24 @@ show line numbers on the left:
   'editorconfig-after-apply-functions
   "0.7.14")
 
+(defcustom editorconfig-hack-properties-functions ()
+  "A list of function to alter property values before applying them.
+
+These functions will be run after loading \".editorconfig\" files and before
+applying them to current buffer, so that you can alter some properties from
+\".editorconfig\" before they take effect.
+
+For example, Makefiles always use tab characters for indentation: you can
+overwrite \"indent_style\" property when current `major-mode' is a
+`makefile-mode' with following code:
+
+  (add-hook 'editorconfig-hack-properties-functions
+            '(lambda (props)
+               (when (derived-mode-p makefile-mode)
+                 (puthash 'indent_style \"tab\" props))))"
+  :type 'hook
+  :group 'editorconfig)
+
 (defcustom editorconfig-indentation-alist
   ;; For contributors: Sort modes in alphabetical order, please :)
   '((apache-mode apache-indent-level)

Reply via email to