diff options
| author | Stefan Monnier | 2024-06-04 11:00:32 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2024-06-06 19:25:41 -0400 |
| commit | 71ac0af5d0191cdf8ebc56066c7ca58dd93487cf (patch) | |
| tree | 2a308c7e5b2c44212fe6cf025935235f23f0bb92 /doc | |
| parent | d12c9bc2a4c8383abdf7fa32b67f1ca0379227e3 (diff) | |
| download | emacs-scratch/editorconfig.tar.gz emacs-scratch/editorconfig.zip | |
(hack-dir-local-get-variables-functions): New hookscratch/editorconfig
Make it possible to provide more dir-local variables, such as
done by the Editorconfig package.
* lisp/files.el (hack-dir-local--get-variables): Make arg optional.
(hack-dir-local-get-variables-functions): New hook.
(hack-dir-local-variables): Run it instead of calling
`hack-dir-local--get-variables`.
* doc/lispref/variables.texi (Directory Local Variables):
Document the new hook.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/variables.texi | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index e05d3bb0f81..c63057e31ea 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -2277,6 +2277,35 @@ modification times of the associated directory local variables file | |||
| 2277 | updates this list. | 2277 | updates this list. |
| 2278 | @end defvar | 2278 | @end defvar |
| 2279 | 2279 | ||
| 2280 | @defvar hack-dir-local-get-variables-functions | ||
| 2281 | This special hook holds the functions that gather the directory-local | ||
| 2282 | variables to use for a given buffer. By default it contains just the | ||
| 2283 | function that obeys the other settings described in the present section. | ||
| 2284 | But it can be used to add support for more sources of directory-local | ||
| 2285 | variables, such as those used by other text editors. | ||
| 2286 | |||
| 2287 | The functions on this hook are called with no argument, in the buffer to | ||
| 2288 | which we intend to apply the directory-local variables, after the | ||
| 2289 | buffer's major mode function has been run, so it can use sources of | ||
| 2290 | information such as @code{major-mode} or @code{buffer-file-name} to find | ||
| 2291 | the variables that should be applied. | ||
| 2292 | |||
| 2293 | It should return either a cons cell of the form @code{(@var{directory} | ||
| 2294 | . @var{alist})} or a list of such cons-cells. A @code{nil} return value | ||
| 2295 | means that it found no directory-local variables. @var{directory} | ||
| 2296 | should be a string: the name of the directory to which the variables | ||
| 2297 | apply. @var{alist} is a list of variables together with their values | ||
| 2298 | that apply to the current buffer, where every element is of the form | ||
| 2299 | @code{(@var{varname} . @var{value})}. | ||
| 2300 | |||
| 2301 | The various @var{alist} returned by these functions will be combined, | ||
| 2302 | and in case of conflicts, the settings coming from deeper directories | ||
| 2303 | will take precedence over those coming from higher directories in the | ||
| 2304 | directory hierarchy. Finally, since this hook is run every time we visit | ||
| 2305 | a file it is important to try and keep those functions efficient, which | ||
| 2306 | will usually require some of caching. | ||
| 2307 | @end defvar | ||
| 2308 | |||
| 2280 | @defvar enable-dir-local-variables | 2309 | @defvar enable-dir-local-variables |
| 2281 | If @code{nil}, directory-local variables are ignored. This variable | 2310 | If @code{nil}, directory-local variables are ignored. This variable |
| 2282 | may be useful for modes that want to ignore directory-locals while | 2311 | may be useful for modes that want to ignore directory-locals while |