diff options
| author | Artur Malabarba | 2015-11-10 13:47:42 +0000 |
|---|---|---|
| committer | Artur Malabarba | 2015-11-10 14:45:50 +0000 |
| commit | d149ca81c33ab95900306c3c71f6eff62a3ec1a1 (patch) | |
| tree | fff842fe86fd57417d237b44dd8cc196b6277058 | |
| parent | 9145e79dc2042fb477959ddda59c3e2ff5fa3914 (diff) | |
| download | emacs-d149ca81c33ab95900306c3c71f6eff62a3ec1a1.tar.gz emacs-d149ca81c33ab95900306c3c71f6eff62a3ec1a1.zip | |
* doc/lispref/variables.texi (Directory Local Variables):
Document dir-locals wildcards
* lisp/files.el (dir-locals-file): Point to Info node.
* doc/emacs/custom.texi (Directory Variables):
Document dir-locals wildcards.
* etc/NEWS: Document new functionality.
| -rw-r--r-- | doc/emacs/custom.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 39 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/files.el | 6 |
4 files changed, 39 insertions, 15 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 76c7261767a..8441c889bbf 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -1290,7 +1290,11 @@ accomplished with @dfn{directory-local variables}. | |||
| 1290 | named @file{.dir-locals.el}@footnote{ On MS-DOS, the name of this file | 1290 | named @file{.dir-locals.el}@footnote{ On MS-DOS, the name of this file |
| 1291 | should be @file{_dir-locals.el}, due to limitations of the DOS | 1291 | should be @file{_dir-locals.el}, due to limitations of the DOS |
| 1292 | filesystems. If the filesystem is limited to 8+3 file names, the name | 1292 | filesystems. If the filesystem is limited to 8+3 file names, the name |
| 1293 | of the file will be truncated by the OS to @file{_dir-loc.el}. } in a | 1293 | of the file will be truncated by the OS to @file{_dir-loc.el}. |
| 1294 | }@footnote{ You can also use files like @file{.dir-locals2.el}, which | ||
| 1295 | are loaded in addition. This is useful when @file{.dir-locals.el} is | ||
| 1296 | under version control in a shared repository and can't be used for | ||
| 1297 | personal customizations. } in a | ||
| 1294 | directory. Whenever Emacs visits any file in that directory or any of | 1298 | directory. Whenever Emacs visits any file in that directory or any of |
| 1295 | its subdirectories, it will apply the directory-local variables | 1299 | its subdirectories, it will apply the directory-local variables |
| 1296 | specified in @file{.dir-locals.el}, as though they had been defined as | 1300 | specified in @file{.dir-locals.el}, as though they had been defined as |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 1d920942d10..f49d5062f20 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -1765,20 +1765,33 @@ variables: by putting them in a special file, or by defining a | |||
| 1765 | @dfn{project class} for that directory. | 1765 | @dfn{project class} for that directory. |
| 1766 | 1766 | ||
| 1767 | @defvr Constant dir-locals-file | 1767 | @defvr Constant dir-locals-file |
| 1768 | This constant is the name of the file where Emacs expects to find the | 1768 | This constant is a wildcard pattern matching the name of files where |
| 1769 | directory-local variables. The name of the file is | 1769 | Emacs expects to find directory-local variables. Its value is |
| 1770 | @file{.dir-locals.el}@footnote{ | 1770 | @file{.dir-locals*.el}@footnote{ |
| 1771 | The MS-DOS version of Emacs uses @file{_dir-locals.el} instead, due to | 1771 | The MS-DOS version of Emacs uses @file{_dir-locals*.el} instead, due to |
| 1772 | limitations of the DOS filesystems. | 1772 | limitations of the DOS filesystems. |
| 1773 | }. A file by that name in a directory causes Emacs to apply its | 1773 | }, and the most common file name to use is @file{.dir-locals.el}. |
| 1774 | settings to any file in that directory or any of its subdirectories | 1774 | |
| 1775 | (optionally, you can exclude subdirectories; see below). | 1775 | Any file matching this name pattern in a directory causes Emacs to |
| 1776 | If some of the subdirectories have their own @file{.dir-locals.el} | 1776 | apply its settings when visiting files in that directory or any of its |
| 1777 | files, Emacs uses the settings from the deepest file it finds starting | 1777 | subdirectories (optionally, you can exclude subdirectories; see |
| 1778 | from the file's directory and moving up the directory tree. The file | 1778 | below). |
| 1779 | specifies local variables as a specially formatted list; see | 1779 | If some of the subdirectories have their own file matching |
| 1780 | @ref{Directory Variables, , Per-directory Local Variables, emacs, The | 1780 | @file{.dir-locals*.el}, Emacs uses the settings from the deepest file |
| 1781 | GNU Emacs Manual}, for more details. | 1781 | it finds starting from the file's directory and moving up the |
| 1782 | directory tree. The file specifies local variables as a specially | ||
| 1783 | formatted list; see @ref{Directory Variables, , Per-directory Local | ||
| 1784 | Variables, emacs, The GNU Emacs Manual}, for more details. | ||
| 1785 | |||
| 1786 | If the same directory contains multiple such files (for instance, | ||
| 1787 | @file{.dir-locals.el} and @file{.dir-locals2.el}), then all of them | ||
| 1788 | are used in @code{string<} order. This means that, if two files | ||
| 1789 | specify different values for the same variable, the file sorted after | ||
| 1790 | will override the value of the previous file (for instance, values in | ||
| 1791 | @file{.dir-locals2.el} override those in @file{.dir-locals.el}). Note | ||
| 1792 | that, because of how lexicographic order works, values in | ||
| 1793 | @file{.dir-locals10.el} are overriden by values in @file{.dir-locals2.el}. | ||
| 1794 | This can be avoided by using @file{.dir-locals02.el} instead. | ||
| 1782 | @end defvr | 1795 | @end defvr |
| 1783 | 1796 | ||
| 1784 | @defun hack-dir-local-variables | 1797 | @defun hack-dir-local-variables |
| @@ -103,6 +103,9 @@ and can contain escape sequences for command keys, quotes, and the like. | |||
| 103 | 103 | ||
| 104 | * Changes in Emacs 25.1 | 104 | * Changes in Emacs 25.1 |
| 105 | 105 | ||
| 106 | ** Any file of the form .dir-locals*.el is now considered a dir-local | ||
| 107 | file, and multiple can be used in the same directory. See the | ||
| 108 | variable `dir-locals-file' for more information. | ||
| 106 | ** `xref-find-definitions' and `describe-function' now display | 109 | ** `xref-find-definitions' and `describe-function' now display |
| 107 | information about mode local overrides (defined by | 110 | information about mode local overrides (defined by |
| 108 | cedet/mode-local.el `define-overloadable-function' and | 111 | cedet/mode-local.el `define-overloadable-function' and |
diff --git a/lisp/files.el b/lisp/files.el index b4ede7897d9..fdda9b2a77e 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3701,7 +3701,11 @@ VARIABLES list of the class. The list is processed in order. | |||
| 3701 | (defconst dir-locals-file ".dir-locals*.el" | 3701 | (defconst dir-locals-file ".dir-locals*.el" |
| 3702 | "Pattern for files that contain directory-local variables. | 3702 | "Pattern for files that contain directory-local variables. |
| 3703 | It has to be constant to enforce uniform values across different | 3703 | It has to be constant to enforce uniform values across different |
| 3704 | environments and users.") | 3704 | environments and users. |
| 3705 | |||
| 3706 | Multiple dir-locals files in the same directory are loaded in | ||
| 3707 | `string<' order. | ||
| 3708 | See Info node `(elisp)Directory Local Variables' for details.") | ||
| 3705 | 3709 | ||
| 3706 | (defun dir-locals--all-files (file-or-dir) | 3710 | (defun dir-locals--all-files (file-or-dir) |
| 3707 | "Return a list of all readable dir-locals files matching FILE-OR-DIR. | 3711 | "Return a list of all readable dir-locals files matching FILE-OR-DIR. |