branch: scratch/editorconfig-cc commit e24803269d7e40b8437ea1580380078cde10dcca Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Update document --- README.md | 20 ++++++++++++++++++++ doc/editorconfig.texi | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/README.md b/README.md index e18ebccb8a..171e2e4c6e 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,26 @@ only blocks of `web-mode`: it can be achieved by adding following to your init.e You can also define your own custom properties and enable them here. +### `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: + +``` emacs-lisp +(add-hook 'editorconfig-hack-properties-functions + '(lambda (props) + (when (derived-mode-p makefile-mode) + (puthash 'indent_style \"tab\" props)))) + +``` + ### `editorconfig-indentation-alist` Alist of indentaion setting mothods by modes. diff --git a/doc/editorconfig.texi b/doc/editorconfig.texi index 58c6d8f0cc..c37167929e 100644 --- a/doc/editorconfig.texi +++ b/doc/editorconfig.texi @@ -130,6 +130,7 @@ precedence. @anchor{#customize} @menu * editorconfig-after-apply-functions:: +* editorconfig-hack-properties-functions:: * editorconfig-indentation-alist:: * editorconfig-exec-path:: * editorconfig-get-properties-function:: @@ -155,6 +156,26 @@ achieved by adding following to your init.el: You can also define your own custom properties and enable them here. +@node editorconfig-hack-properties-functions +@subsection @code{editorconfig-hack-properties-functions} +@anchor{#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 @code{major-mode} is +a @code{makefile-mode} with following code: + +@verbatim +(add-hook 'editorconfig-hack-properties-functions + '(lambda (props) + (when (derived-mode-p makefile-mode) + (puthash 'indent_style \"tab\" props)))) +@end verbatim + @node editorconfig-indentation-alist @subsection @code{editorconfig-indentation-alist} @anchor{#editorconfig-indentation-alist}