branch: scratch/editorconfig-cc commit 876e476dedcf30b263cabac3e932926bb2f0b8ce Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Update README --- README.md | 85 +++++++++++++++++++++++++++------------------------------ editorconfig.el | 21 +++++++++++++- 2 files changed, 60 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index dabf1753da..dd957fa901 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,38 @@ [](http://melpa.org/#/editorconfig) [](https://stable.melpa.org/#/editorconfig) -This plugin also has a built-in core library implemented in Emacs-Lisp, and -fallback to it when no core executable is found. +## Setup + +This package is available on [MELPA](https://melpa.org/#/editorconfig) +and [MELPA Stable](https://stable.melpa.org/#/editorconfig). +Install from there and enable global minor-mode `editorconfig-mode`: ```emacs-lisp - (require 'editorconfig) - (editorconfig-mode 1) +(editorconfig-mode 1) ``` -Alternatively, you can find the package available on -[MELPA](https://melpa.org/#/editorconfig) and [MELPA Stable](https://stable.melpa.org/#/editorconfig) -([The Marmalade package](http://marmalade-repo.org/packages/editorconfig) is deprecated). + +To install manually copy all `.el` files in this repository to +`~/.emacs.d/lisp` and add the following to your `init.el` file: + +```emacs-lisp +(add-to-list 'load-path "~/.emacs.d/lisp") +(require 'editorconfig) +(editorconfig-mode 1) +``` + +### Install a Core Program + +This package requires a Core program. +The officially recommended one is [EditorConfig C Core][], +follow the instructions in the README and INSTALL files to install it. + +Though using C Core is recommended, but this plugin also +includes a core library implemented in Emacs Lisp. +This plugin uses this as a fallback method when no core executable +is found, so it works out-of-the-box without explicitly installing +any other core program. + ## Supported properties @@ -41,6 +62,12 @@ future updates. When both are specified, `file_type_ext` takes precedence. ## Customize +`editorconfig-emacs` provides some customize variables. + +Here are some of these variables: for the full list of available variables, +type <kbd>M-x customize-group [RET] editorconfig [RET]</kbd>. + + ### `editorconfig-after-apply-functions` (Formerly `editorconfig-custom-hooks`) @@ -59,6 +86,7 @@ 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. @@ -79,6 +107,7 @@ overwrite \"indent_style\" property when current `major-mode` is a ``` + ### `editorconfig-indentation-alist` Alist of indentaion setting mothods by modes. @@ -92,52 +121,18 @@ add a pair of major-mode symbol and its indentation variables: '(c-mode c-basic-offset)) ``` -You can also modify this variable with the command -<kbd>M-x customize-variable [RET] editorconfig-indentation-alist [RET]</kbd>. -For a bit more compilicated cases please take a look at the docstring of this variable. - -### `editorconfig-exec-path` - -String of `editorconfig` executable name (command name or full path to -the executable). - - -### `editorconfig-get-properties-function` - -Function to use to get EditorConfig properties. - -For example, if you always want to use built-in core library instead -of any EditorConfig executable to get properties, add following to -your init.el: - -``` emacs-lisp -(set-variable 'editorconfig-get-properties-function - #'editorconfig-core-get-properties-hash) -``` - -Possible known values are: - -* `editorconfig-get-properties` (default) - * Use `editorconfig-get-properties-from-exec` when - `editorconfig-exec-path` executable is found, otherwise use - `editorconfig-core-get-properties-hash` -* `editorconfig-get-properties-from-exec` - * Get properties by executing EditorConfig executable specified in - `editorconfig-exec-path` -* `editorconfig-core-get-properties-hash` - * Always use built-in Emacs-Lisp implementation to get properties - ### `editorconfig-trim-whitespaces-mode` Buffer local minor-mode to use to trim trailing whitespaces. -If set, enable that mode when `trim_trailing_whitespace` is set to true. -Otherwise, use `delete-trailing-whitespace`. +If set, enable/disable that mode in accord with `trim_trailing_whitespace` +property in `.editorconfig`. +Otherwise, use Emacs built-in `delete-trailing-whitespace` function. One possible value is [`ws-butler-mode`](https://github.com/lewang/ws-butler), with which -only lines touched get trimmed. To use it, add following to yo +only lines touched get trimmed. To use it, add following to your init.el: ``` emacs-lisp diff --git a/editorconfig.el b/editorconfig.el index 357746edc4..d4e30c48c2 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -78,7 +78,26 @@ This executable is invoked by `editorconfig-call-editorconfig-exec'." This function will be called with no argument and should return a hash object containing properties, or nil if any core program is not available. The hash object should have symbols of property -names as keys and strings of property values as values." +names as keys and strings of property values as values. + + +For example, if you always want to use built-in core library instead +of any EditorConfig executable to get properties, add following to +your init.el: + +(set-variable 'editorconfig-get-properties-function + #'editorconfig-core-get-properties-hash) + +Possible known values are: + +* `editorconfig-get-properties' (default) + * Use `editorconfig-get-properties-from-exec' when + `editorconfig-exec-path' executable executable is found, otherwise + use `editorconfig-core-get-properties-hash' +* `editorconfig-get-properties-from-exec' + * Get properties by executing EditorConfig executable +* `editorconfig-core-get-properties-hash' + * Always use built-in Emacs-Lisp implementation to get properties" :type 'function :group 'editorconfig) (define-obsolete-variable-alias