emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d149ca8: * doc/lispref/variables.texi (Directory Lo


From: Artur Malabarba
Subject: [Emacs-diffs] master d149ca8: * doc/lispref/variables.texi (Directory Local Variables):
Date: Tue, 10 Nov 2015 13:48:36 +0000

branch: master
commit d149ca81c33ab95900306c3c71f6eff62a3ec1a1
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * 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.
---
 doc/emacs/custom.texi      |    6 +++++-
 doc/lispref/variables.texi |   39 ++++++++++++++++++++++++++-------------
 etc/NEWS                   |    3 +++
 lisp/files.el              |    6 +++++-
 4 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 76c7261..8441c88 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1290,7 +1290,11 @@ accomplished with @dfn{directory-local variables}.
 named @address@hidden On MS-DOS, the name of this file
 should be @file{_dir-locals.el}, due to limitations of the DOS
 filesystems.  If the filesystem is limited to 8+3 file names, the name
-of the file will be truncated by the OS to @file{_dir-loc.el}.  } in a
+of the file will be truncated by the OS to @file{_dir-loc.el}.
address@hidden You can also use files like @file{.dir-locals2.el}, which
+are loaded in addition.  This is useful when @file{.dir-locals.el} is
+under version control in a shared repository and can't be used for
+personal customizations.  } in a
 directory.  Whenever Emacs visits any file in that directory or any of
 its subdirectories, it will apply the directory-local variables
 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 1d92094..f49d506 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
 @dfn{project class} for that directory.
 
 @defvr Constant dir-locals-file
-This constant is the name of the file where Emacs expects to find the
-directory-local variables.  The name of the file is
address@hidden@footnote{
-The MS-DOS version of Emacs uses @file{_dir-locals.el} instead, due to
+This constant is a wildcard pattern matching the name of files where
+Emacs expects to find directory-local variables.  Its value is
address@hidden@footnote{
+The MS-DOS version of Emacs uses @file{_dir-locals*.el} instead, due to
 limitations of the DOS filesystems.
-}.  A file by that name in a directory causes Emacs to apply its
-settings to any file in that directory or any of its subdirectories
-(optionally, you can exclude subdirectories; see below).
-If some of the subdirectories have their own @file{.dir-locals.el}
-files, Emacs uses the settings from the deepest file it finds starting
-from the file's directory and moving up the directory tree.  The file
-specifies local variables as a specially formatted list; see
address@hidden Variables, , Per-directory Local Variables, emacs, The
-GNU Emacs Manual}, for more details.
+}, and the most common file name to use is @file{.dir-locals.el}.
+
+Any file matching this name pattern in a directory causes Emacs to
+apply its settings when visiting files in that directory or any of its
+subdirectories (optionally, you can exclude subdirectories; see
+below).
+If some of the subdirectories have their own file matching
address@hidden, Emacs uses the settings from the deepest file
+it finds starting from the file's directory and moving up the
+directory tree.  The file specifies local variables as a specially
+formatted list; see @ref{Directory Variables, , Per-directory Local
+Variables, emacs, The GNU Emacs Manual}, for more details.
+
+If the same directory contains multiple such files (for instance,
address@hidden and @file{.dir-locals2.el}), then all of them
+are used in @code{string<} order.  This means that, if two files
+specify different values for the same variable, the file sorted after
+will override the value of the previous file (for instance, values in
address@hidden override those in @file{.dir-locals.el}).  Note
+that, because of how lexicographic order works, values in
address@hidden are overriden by values in @file{.dir-locals2.el}.
+This can be avoided by using @file{.dir-locals02.el} instead.
 @end defvr
 
 @defun hack-dir-local-variables
diff --git a/etc/NEWS b/etc/NEWS
index 4c5639f..f3df92e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -103,6 +103,9 @@ and can contain escape sequences for command keys, quotes, 
and the like.
 
 * Changes in Emacs 25.1
 
+** Any file of the form .dir-locals*.el is now considered a dir-local
+   file, and multiple can be used in the same directory. See the
+   variable `dir-locals-file' for more information.
 ** `xref-find-definitions' and `describe-function' now display
    information about mode local overrides (defined by
    cedet/mode-local.el `define-overloadable-function' and
diff --git a/lisp/files.el b/lisp/files.el
index b4ede78..fdda9b2 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3701,7 +3701,11 @@ VARIABLES list of the class.  The list is processed in 
order.
 (defconst dir-locals-file ".dir-locals*.el"
   "Pattern for files that contain directory-local variables.
 It has to be constant to enforce uniform values across different
-environments and users.")
+environments and users.
+
+Multiple dir-locals files in the same directory are loaded in
+`string<' order.
+See Info node `(elisp)Directory Local Variables' for details.")
 
 (defun dir-locals--all-files (file-or-dir)
   "Return a list of all readable dir-locals files matching FILE-OR-DIR.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]