diff options
| author | Artur Malabarba | 2016-01-16 08:50:46 +0000 |
|---|---|---|
| committer | Artur Malabarba | 2016-01-16 08:53:33 +0000 |
| commit | f0b82b34536e6bafbecbd642eee0cb0f534f8647 (patch) | |
| tree | c717d188a43e9166507111451700bff13194a551 | |
| parent | 86e45139698fe773ffb4efbe59387f90201b80c8 (diff) | |
| download | emacs-f0b82b34536e6bafbecbd642eee0cb0f534f8647.tar.gz emacs-f0b82b34536e6bafbecbd642eee0cb0f534f8647.zip | |
* 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.
| -rw-r--r-- | lisp/dos-fns.el | 4 | ||||
| -rw-r--r-- | lisp/files-x.el | 6 | ||||
| -rw-r--r-- | lisp/files.el | 23 | ||||
| -rw-r--r-- | 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 7defb388b74..0ce2b23527d 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 | |||
| 201 | returned unaltered." | 201 | returned unaltered." |
| 202 | (cond | 202 | (cond |
| 203 | ;; See files.el:dir-locals-file. | 203 | ;; See files.el:dir-locals-file. |
| 204 | ((string= file-name ".dir-locals.el") | 204 | ((string= file-name ".dir-locals") |
| 205 | "_dir-locals.el") | 205 | "_dir-locals") |
| 206 | (t | 206 | (t |
| 207 | file-name))) | 207 | file-name))) |
| 208 | 208 | ||
diff --git a/lisp/files-x.el b/lisp/files-x.el index ed3d49df385..2e1a728356e 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el | |||
| @@ -444,10 +444,8 @@ from the MODE alist ignoring the input argument VALUE." | |||
| 444 | (if (nth 2 variables-file) | 444 | (if (nth 2 variables-file) |
| 445 | (car (last (dir-locals--all-files (car variables-file)))) | 445 | (car (last (dir-locals--all-files (car variables-file)))) |
| 446 | (cadr variables-file))) | 446 | (cadr variables-file))) |
| 447 | ;; Try to make a proper file-name. This doesn't cover all | 447 | ;; Try to make a proper file-name. |
| 448 | ;; wildcards, but it covers the default value of `dir-locals-file'. | 448 | (t (concat dir-locals-file ".el")))) |
| 449 | (t (replace-regexp-in-string | ||
| 450 | "\\*" "" (replace-regexp-in-string "\\?" "-" dir-locals-file))))) | ||
| 451 | ;; I can't be bothered to handle this case right now. | 449 | ;; I can't be bothered to handle this case right now. |
| 452 | ;; Dir locals were set directly from a class. You need to | 450 | ;; Dir locals were set directly from a class. You need to |
| 453 | ;; directly modify the class in dir-locals-class-alist. | 451 | ;; directly modify the class in dir-locals-class-alist. |
diff --git a/lisp/files.el b/lisp/files.el index 9cb46fcd0a9..7c6119b7ef9 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3713,7 +3713,7 @@ VARIABLES list of the class. The list is processed in order. | |||
| 3713 | applied by recursively following these rules." | 3713 | applied by recursively following these rules." |
| 3714 | (setf (alist-get class dir-locals-class-alist) variables)) | 3714 | (setf (alist-get class dir-locals-class-alist) variables)) |
| 3715 | 3715 | ||
| 3716 | (defconst dir-locals-file ".dir-locals*.el" | 3716 | (defconst dir-locals-file ".dir-locals" |
| 3717 | "Pattern for files that contain directory-local variables. | 3717 | "Pattern for files that contain directory-local variables. |
| 3718 | It has to be constant to enforce uniform values across different | 3718 | It has to be constant to enforce uniform values across different |
| 3719 | environments and users. | 3719 | environments and users. |
| @@ -3730,16 +3730,19 @@ return a sorted list of all files matching `dir-locals-file' in | |||
| 3730 | this directory. | 3730 | this directory. |
| 3731 | The returned list is sorted by `string<' order." | 3731 | The returned list is sorted by `string<' order." |
| 3732 | (require 'seq) | 3732 | (require 'seq) |
| 3733 | (let ((default-directory (if (file-directory-p file-or-dir) | 3733 | (let ((dir (if (file-directory-p file-or-dir) |
| 3734 | file-or-dir | 3734 | file-or-dir |
| 3735 | default-directory))) | 3735 | default-directory)) |
| 3736 | (file (cond ((not (file-directory-p file-or-dir)) file-or-dir) | ||
| 3737 | ((eq system-type 'ms-dos) (dosified-file-name dir-locals-file)) | ||
| 3738 | (t dir-locals-file)))) | ||
| 3736 | (seq-filter (lambda (f) (and (file-readable-p f) | 3739 | (seq-filter (lambda (f) (and (file-readable-p f) |
| 3737 | (file-regular-p f))) | 3740 | (file-regular-p f) |
| 3738 | (file-expand-wildcards | 3741 | (not (file-directory-p f)))) |
| 3739 | (cond ((not (file-directory-p file-or-dir)) file-or-dir) | 3742 | (mapcar (lambda (f) (expand-file-name f dir)) |
| 3740 | ((eq system-type 'ms-dos) (dosified-file-name dir-locals-file)) | 3743 | (nreverse |
| 3741 | (t dir-locals-file)) | 3744 | (let ((completion-regexp-list '("\\.el\\'"))) |
| 3742 | 'full)))) | 3745 | (file-name-all-completions file dir))))))) |
| 3743 | 3746 | ||
| 3744 | (defun dir-locals-find-file (file) | 3747 | (defun dir-locals-find-file (file) |
| 3745 | "Find the directory-local variables for FILE. | 3748 | "Find the directory-local variables for FILE. |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index bc96601a45c..13daafb0f20 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -918,25 +918,24 @@ if it is given a local binding.\n")))) | |||
| 918 | ;; If the cache element has an mtime, we | 918 | ;; If the cache element has an mtime, we |
| 919 | ;; assume it came from a file. | 919 | ;; assume it came from a file. |
| 920 | (if (nth 2 file) | 920 | (if (nth 2 file) |
| 921 | (setq file (expand-file-name | 921 | ;; (car file) is a directory. |
| 922 | dir-locals-file (car file))) | 922 | (setq file (dir-locals--all-files (car file))) |
| 923 | ;; Otherwise, assume it was set directly. | 923 | ;; Otherwise, assume it was set directly. |
| 924 | (setq file (car file) | 924 | (setq file (car file) |
| 925 | is-directory t))) | 925 | is-directory t))) |
| 926 | (if (null file) | 926 | (if (null file) |
| 927 | (princ ".\n") | 927 | (princ ".\n") |
| 928 | (princ ", set ") | 928 | (princ ", set ") |
| 929 | (let ((files (file-expand-wildcards file))) | 929 | (princ (substitute-command-keys |
| 930 | (princ (substitute-command-keys | 930 | (cond |
| 931 | (cond | 931 | (is-directory "for the directory\n `") |
| 932 | (is-directory "for the directory\n `") | 932 | ;; Many files matched. |
| 933 | ;; Many files matched. | 933 | ((and (consp file) (cdr file)) |
| 934 | ((cdr files) | 934 | (setq file (file-name-directory (car file))) |
| 935 | (setq file (file-name-directory (car files))) | 935 | (format "by one of the\n %s files in the directory\n `" |
| 936 | (format "by a file\n matching `%s' in the directory\n `" | 936 | dir-locals-file)) |
| 937 | dir-locals-file)) | 937 | (t (setq file (car file)) |
| 938 | (t (setq file (car files)) | 938 | "by the file\n `")))) |
| 939 | "by the file\n `")))) | ||
| 940 | (with-current-buffer standard-output | 939 | (with-current-buffer standard-output |
| 941 | (insert-text-button | 940 | (insert-text-button |
| 942 | file 'type 'help-dir-local-var-def | 941 | file 'type 'help-dir-local-var-def |