unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob 5e7d3b85552e2ae6f4f777efca1d94a8bedcc7cd 9264 bytes (raw)
name: doc/man/editorconfig.texi 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
 
@dircategory Emacs
@direntry
* EditorConfig: (editorconfig). EditorConfig Emacs Plugin.
@end direntry

@node Top
@chapter EditorConfig Emacs Plugin
@anchor{#editorconfig-emacs-plugin}
This is an @uref{https://editorconfig.org,EditorConfig} plugin for
@uref{https://www.gnu.org/software/emacs/,Emacs}.

@menu
* Getting Started::
* Supported properties::
* Customize::
* Troubleshooting::
* Submitting Bugs and Feature Requests::
* License::
@end menu

@node Getting Started
@section Getting Started
@anchor{#getting-started}

@menu
* packageel::
* use-package::
* Manual installation::
@end menu

@node packageel
@subsection package.el
@anchor{#package.el}
This package is available from
@uref{https://melpa.org/#/editorconfig,MELPA},
@uref{https://stable.melpa.org/#/editorconfig,MELPA Stable} and
@uref{http://elpa.nongnu.org/nongnu/editorconfig.html,NonGNU ELPA}.
Install from these repositories and enable global minor-mode
@code{editorconfig-mode}:

@verbatim
(editorconfig-mode 1)
@end verbatim

Normally, enabling @code{editorconfig-mode} should be enough for this
plugin to work: all other configurations are optional. This mode sets up
hooks so that EditorConfig properties will be loaded and applied to the
new buffers automatically when visiting files.

@node use-package
@subsection use-package
@anchor{#use-package}
If you use
@uref{https://www.emacswiki.org/emacs/UsePackage,@strong{use-package}},
add the following to your @code{init.el} file:

@verbatim
(use-package editorconfig
  :ensure t
  :config
  (editorconfig-mode 1))
@end verbatim

@node Manual installation
@subsection Manual installation
@anchor{#manual-installation}
Copy all @code{.el} files in this repository to @code{~/.emacs.d/lisp}
and add the following:

@verbatim
(add-to-list 'load-path "~/.emacs.d/lisp")
(require 'editorconfig)
(editorconfig-mode 1)
@end verbatim

@node Supported properties
@section Supported properties
@anchor{#supported-properties}
Current Emacs plugin coverage for EditorConfig's
@uref{https://editorconfig.org/#supported-properties,properties}:

@itemize
@item
@code{indent_style}
@item
@code{indent_size}
@item
@code{tab_width}
@item
@code{end_of_line}
@item
@code{charset}
@item
@code{trim_trailing_whitespace}
@item
@code{insert_final_newline = true} is supported
@item
@code{insert_final_newline = false}
is not enforced (as in trailing newlines actually being removed
automagically), we just buffer-locally override any preferences that
would auto-add them to files @code{.editorconfig} marks as
trailing-newline-free
@item
@code{max_line_length}
@item
@code{file_type_ext} (Experimental)
(See below)
@item
@code{file_type_emacs} (Experimental)
(See below)
@item
@code{root} (only used by EditorConfig core)
@end itemize

Not yet covered properties marked with over-strike -- pull requests
implementing missing features warmly welcomed! Typically, you will want
to tie these to native functionality, or the configuration of existing
packages handling the feature.

As several packages have their own handling of, say, indentation, we
might not yet cover some mode you use, but we try to add the ones that
show up on our radar.

@menu
* File Type file_type_ext file_type_emacs::
@end menu

@node File Type file_type_ext file_type_emacs
@subsection File Type (file_type_ext, file_type_emacs)
@anchor{#file-type-file_type_ext-file_type_emacs}
File-type feature is currently disabled, because this package is now
undergoing big internal refactoring. For those who want this
functionality, please consider using
@uref{https://github.com/10sr/editorconfig-custom-majormode-el,editorconfig-custom-majormode}.

@node Customize
@section Customize
@anchor{#customize}
@code{editorconfig-emacs} provides some customize variables.

Here are some of these variables: for the full list of available
variables, type M-x customize-group [RET] editorconfig [RET].

@menu
* editorconfig-trim-whitespaces-mode::
* editorconfig-after-apply-functions::
* editorconfig-hack-properties-functions::
@end menu

@node editorconfig-trim-whitespaces-mode
@subsection @code{editorconfig-trim-whitespaces-mode}
@anchor{#editorconfig-trim-whitespaces-mode}
Buffer local minor-mode to use to trim trailing whitespaces.

If set, editorconfig will enable/disable this mode in accord with
@code{trim_trailing_whitespace} property in @code{.editorconfig}.
Otherwise, use Emacs built-in @code{delete-trailing-whitespace}
function.

One possible value is
@uref{https://github.com/lewang/ws-butler,@code{ws-butler-mode}}, with
which only lines touched get trimmed. To use it, add following to your
init.el:

@verbatim
(setq editorconfig-trim-whitespaces-mode
      'ws-butler-mode)
@end verbatim

@node editorconfig-after-apply-functions
@subsection @code{editorconfig-after-apply-functions}
@anchor{#editorconfig-after-apply-functions}
(Formerly @code{editorconfig-custom-hooks})

A list of functions which will be called after loading common
EditorConfig settings, when you can set some custom variables.

For example, @code{web-mode} has several variables for indentation
offset size and EditorConfig sets them at once by @code{indent_size}.
You can stop indenting only blocks of @code{web-mode} by adding
following to your init.el:

@verbatim
(add-hook 'editorconfig-after-apply-functions
  (lambda (props) (setq web-mode-block-padding 0)))
@end verbatim

@node editorconfig-hack-properties-functions
@subsection @code{editorconfig-hack-properties-functions}
@anchor{#editorconfig-hack-properties-functions}
A list of functions 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, Makefile files always use tab characters for indentation:
you can overwrite "indent_style" property when current @code{major-mode}
is @code{makefile-mode}:

@verbatim
(add-hook 'editorconfig-hack-properties-functions
          '(lambda (props)
             (when (derived-mode-p 'makefile-mode)
               (puthash 'indent_style "tab" props))))
@end verbatim

@node Troubleshooting
@section Troubleshooting
@anchor{#troubleshooting}
Enabling @code{editorconfig-mode} should be enough for normal cases.

When EditorConfig properties are not effective for unknown reason, we
recommend first trying
@code{M-x editorconfig-display-current-properties}.

This command will open a new buffer and display the EditorConfig
properties loaded for current buffer. You can check if EditorConfig
properties were not read for buffers at all, or they were loaded but did
not take effect for some other reasons.

@menu
* Indentation for new major-modes::
* Not work at all for FOO-mode!::
@end menu

@node Indentation for new major-modes
@subsection Indentation for new major-modes
@anchor{#indentation-for-new-major-modes}
Because most Emacs major-modes have their own indentation settings, this
plugin requires explicit support for each major-mode for
@code{indent_size} property.

By default this plugin ships with settings for many major-modes, but,
sorry to say, it cannot be perfect. Especially it is difficult to
support brand-new major-modes. Please feel free to submit issue or
pull-request for such major-mode!

Supported major-modes and their indentation configs are defined in the
variable @code{editorconfig-indentation-alist}.

@node Not work at all for FOO-mode!
@subsection Not work at all for FOO-mode!
@anchor{#not-work-at-all-for-foo-mode}
Most cases properties are loaded just after visiting files when
@code{editorconfig-mode} is enabled. But it is known that there are
major-modes that this mechanism does not work for and require explicit
call of @code{editorconfig-apply}.

Typically it will occur when the major-mode is not defined using
@code{define-derived-mode} (@code{rpm-spec-mode} is an example for
this). Please feel free to submit issues if you find such modes!

@node Submitting Bugs and Feature Requests
@section Submitting Bugs and Feature Requests
@anchor{#submitting-bugs-and-feature-requests}
Bugs, feature requests, and other issues should be submitted to the
issue tracker: https://github.com/editorconfig/editorconfig-emacs/issues

@menu
* Development::
@end menu

@node Development
@subsection Development
@anchor{#development}
Make and @uref{https://cmake.org,CMake} must be installed to run the
tests locally:

@verbatim
$ make check
@end verbatim

To start a new Emacs process with current @code{*.el} and without
loading user init file, run:

@verbatim
$ make sandbox
@end verbatim

@node License
@section License
@anchor{#license}
EditorConfig Emacs Plugin is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.

You should have received a copy of the GNU General Public License along
with this program. If not, see @url{https://www.gnu.org/licenses/}.

@bye

debug log:

solving 5e7d3b85552 ...
found 5e7d3b85552 in https://git.savannah.gnu.org/cgit/emacs.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).