emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 f0b82b3 1/2: * lisp/files.el (dir-locals--all-fil


From: Artur Malabarba
Subject: [Emacs-diffs] emacs-25 f0b82b3 1/2: * lisp/files.el (dir-locals--all-files): Use completion instead of wildcards
Date: Sat, 16 Jan 2016 10:53:49 +0000

branch: emacs-25
commit f0b82b34536e6bafbecbd642eee0cb0f534f8647
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/files.el (dir-locals--all-files): Use completion instead of wildcards
    
    (dir-locals-file)
    * lisp/files-x.el (modify-dir-local-variable)
    * lisp/dos-fns.el (dosified-file-name)
    * lisp/help-fns.el (describe-variable): Change accordingly.
---
 lisp/dos-fns.el  |    4 ++--
 lisp/files-x.el  |    6 ++----
 lisp/files.el    |   23 +++++++++++++----------
 lisp/help-fns.el |   25 ++++++++++++-------------
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index 7defb38..0ce2b23 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -201,8 +201,8 @@ that are used in Emacs Lisp sources; any other file name 
will be
 returned unaltered."
   (cond
    ;; See files.el:dir-locals-file.
-   ((string= file-name ".dir-locals.el")
-    "_dir-locals.el")
+   ((string= file-name ".dir-locals")
+    "_dir-locals")
    (t
     file-name)))
 
diff --git a/lisp/files-x.el b/lisp/files-x.el
index ed3d49d..2e1a728 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -444,10 +444,8 @@ from the MODE alist ignoring the input argument VALUE."
                    (if (nth 2 variables-file)
                        (car (last (dir-locals--all-files (car 
variables-file))))
                      (cadr variables-file)))
-                  ;; Try to make a proper file-name.  This doesn't cover all
-                  ;; wildcards, but it covers the default value of 
`dir-locals-file'.
-                  (t (replace-regexp-in-string
-                      "\\*" "" (replace-regexp-in-string  "\\?" "-" 
dir-locals-file)))))
+                  ;; Try to make a proper file-name.
+                  (t (concat dir-locals-file ".el"))))
       ;; I can't be bothered to handle this case right now.
       ;; Dir locals were set directly from a class.  You need to
       ;; directly modify the class in dir-locals-class-alist.
diff --git a/lisp/files.el b/lisp/files.el
index 9cb46fc..7c6119b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3713,7 +3713,7 @@ VARIABLES list of the class.  The list is processed in 
order.
   applied by recursively following these rules."
   (setf (alist-get class dir-locals-class-alist) variables))
 
-(defconst dir-locals-file ".dir-locals*.el"
+(defconst dir-locals-file ".dir-locals"
   "Pattern for files that contain directory-local variables.
 It has to be constant to enforce uniform values across different
 environments and users.
@@ -3730,16 +3730,19 @@ return a sorted list of all files matching 
`dir-locals-file' in
 this directory.
 The returned list is sorted by `string<' order."
   (require 'seq)
-  (let ((default-directory (if (file-directory-p file-or-dir)
-                               file-or-dir
-                             default-directory)))
+  (let ((dir (if (file-directory-p file-or-dir)
+                 file-or-dir
+               default-directory))
+        (file (cond ((not (file-directory-p file-or-dir)) file-or-dir)
+                    ((eq system-type 'ms-dos) (dosified-file-name 
dir-locals-file))
+                    (t dir-locals-file))))
     (seq-filter (lambda (f) (and (file-readable-p f)
-                            (file-regular-p f)))
-                (file-expand-wildcards
-                 (cond ((not (file-directory-p file-or-dir)) file-or-dir)
-                       ((eq system-type 'ms-dos) (dosified-file-name 
dir-locals-file))
-                       (t dir-locals-file))
-                 'full))))
+                            (file-regular-p f)
+                            (not (file-directory-p f))))
+                (mapcar (lambda (f) (expand-file-name f dir))
+                        (nreverse
+                         (let ((completion-regexp-list '("\\.el\\'")))
+                           (file-name-all-completions file dir)))))))
 
 (defun dir-locals-find-file (file)
   "Find the directory-local variables for FILE.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index bc96601..13daafb 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -918,25 +918,24 @@ if it is given a local binding.\n"))))
                         ;; If the cache element has an mtime, we
                         ;; assume it came from a file.
                         (if (nth 2 file)
-                            (setq file (expand-file-name
-                                        dir-locals-file (car file)))
+                            ;; (car file) is a directory.
+                            (setq file (dir-locals--all-files (car file)))
                           ;; Otherwise, assume it was set directly.
                           (setq file (car file)
                                 is-directory t)))
                       (if (null file)
                           (princ ".\n")
                         (princ ", set ")
-                        (let ((files (file-expand-wildcards file)))
-                          (princ (substitute-command-keys
-                                  (cond
-                                   (is-directory "for the directory\n  `")
-                                   ;; Many files matched.
-                                   ((cdr files)
-                                    (setq file (file-name-directory (car 
files)))
-                                    (format "by a file\n  matching `%s' in the 
directory\n  `"
-                                            dir-locals-file))
-                                   (t (setq file (car files))
-                                      "by the file\n  `"))))
+                        (princ (substitute-command-keys
+                                (cond
+                                 (is-directory "for the directory\n  `")
+                                 ;; Many files matched.
+                                 ((and (consp file) (cdr file))
+                                  (setq file (file-name-directory (car file)))
+                                  (format "by one of the\n  %s files in the 
directory\n  `"
+                                          dir-locals-file))
+                                 (t (setq file (car file))
+                                    "by the file\n  `"))))
                        (with-current-buffer standard-output
                          (insert-text-button
                           file 'type 'help-dir-local-var-def



reply via email to

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