mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-11 08:30:45 -08:00
* 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.
This commit is contained in:
parent
86e4513969
commit
f0b82b3453
4 changed files with 29 additions and 29 deletions
|
|
@ -201,8 +201,8 @@ that are used in Emacs Lisp sources; any other file name will be
|
||||||
returned unaltered."
|
returned unaltered."
|
||||||
(cond
|
(cond
|
||||||
;; See files.el:dir-locals-file.
|
;; See files.el:dir-locals-file.
|
||||||
((string= file-name ".dir-locals.el")
|
((string= file-name ".dir-locals")
|
||||||
"_dir-locals.el")
|
"_dir-locals")
|
||||||
(t
|
(t
|
||||||
file-name)))
|
file-name)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,10 +444,8 @@ from the MODE alist ignoring the input argument VALUE."
|
||||||
(if (nth 2 variables-file)
|
(if (nth 2 variables-file)
|
||||||
(car (last (dir-locals--all-files (car variables-file))))
|
(car (last (dir-locals--all-files (car variables-file))))
|
||||||
(cadr variables-file)))
|
(cadr variables-file)))
|
||||||
;; Try to make a proper file-name. This doesn't cover all
|
;; Try to make a proper file-name.
|
||||||
;; wildcards, but it covers the default value of `dir-locals-file'.
|
(t (concat dir-locals-file ".el"))))
|
||||||
(t (replace-regexp-in-string
|
|
||||||
"\\*" "" (replace-regexp-in-string "\\?" "-" dir-locals-file)))))
|
|
||||||
;; I can't be bothered to handle this case right now.
|
;; I can't be bothered to handle this case right now.
|
||||||
;; Dir locals were set directly from a class. You need to
|
;; Dir locals were set directly from a class. You need to
|
||||||
;; directly modify the class in dir-locals-class-alist.
|
;; directly modify the class in dir-locals-class-alist.
|
||||||
|
|
|
||||||
|
|
@ -3713,7 +3713,7 @@ VARIABLES list of the class. The list is processed in order.
|
||||||
applied by recursively following these rules."
|
applied by recursively following these rules."
|
||||||
(setf (alist-get class dir-locals-class-alist) variables))
|
(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.
|
"Pattern for files that contain directory-local variables.
|
||||||
It has to be constant to enforce uniform values across different
|
It has to be constant to enforce uniform values across different
|
||||||
environments and users.
|
environments and users.
|
||||||
|
|
@ -3730,16 +3730,19 @@ return a sorted list of all files matching `dir-locals-file' in
|
||||||
this directory.
|
this directory.
|
||||||
The returned list is sorted by `string<' order."
|
The returned list is sorted by `string<' order."
|
||||||
(require 'seq)
|
(require 'seq)
|
||||||
(let ((default-directory (if (file-directory-p file-or-dir)
|
(let ((dir (if (file-directory-p file-or-dir)
|
||||||
file-or-dir
|
file-or-dir
|
||||||
default-directory)))
|
default-directory))
|
||||||
(seq-filter (lambda (f) (and (file-readable-p f)
|
(file (cond ((not (file-directory-p file-or-dir)) file-or-dir)
|
||||||
(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))
|
((eq system-type 'ms-dos) (dosified-file-name dir-locals-file))
|
||||||
(t dir-locals-file))
|
(t dir-locals-file))))
|
||||||
'full))))
|
(seq-filter (lambda (f) (and (file-readable-p f)
|
||||||
|
(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)
|
(defun dir-locals-find-file (file)
|
||||||
"Find the directory-local variables for FILE.
|
"Find the directory-local variables for FILE.
|
||||||
|
|
|
||||||
|
|
@ -918,24 +918,23 @@ if it is given a local binding.\n"))))
|
||||||
;; If the cache element has an mtime, we
|
;; If the cache element has an mtime, we
|
||||||
;; assume it came from a file.
|
;; assume it came from a file.
|
||||||
(if (nth 2 file)
|
(if (nth 2 file)
|
||||||
(setq file (expand-file-name
|
;; (car file) is a directory.
|
||||||
dir-locals-file (car file)))
|
(setq file (dir-locals--all-files (car file)))
|
||||||
;; Otherwise, assume it was set directly.
|
;; Otherwise, assume it was set directly.
|
||||||
(setq file (car file)
|
(setq file (car file)
|
||||||
is-directory t)))
|
is-directory t)))
|
||||||
(if (null file)
|
(if (null file)
|
||||||
(princ ".\n")
|
(princ ".\n")
|
||||||
(princ ", set ")
|
(princ ", set ")
|
||||||
(let ((files (file-expand-wildcards file)))
|
|
||||||
(princ (substitute-command-keys
|
(princ (substitute-command-keys
|
||||||
(cond
|
(cond
|
||||||
(is-directory "for the directory\n `")
|
(is-directory "for the directory\n `")
|
||||||
;; Many files matched.
|
;; Many files matched.
|
||||||
((cdr files)
|
((and (consp file) (cdr file))
|
||||||
(setq file (file-name-directory (car files)))
|
(setq file (file-name-directory (car file)))
|
||||||
(format "by a file\n matching `%s' in the directory\n `"
|
(format "by one of the\n %s files in the directory\n `"
|
||||||
dir-locals-file))
|
dir-locals-file))
|
||||||
(t (setq file (car files))
|
(t (setq file (car file))
|
||||||
"by the file\n `"))))
|
"by the file\n `"))))
|
||||||
(with-current-buffer standard-output
|
(with-current-buffer standard-output
|
||||||
(insert-text-button
|
(insert-text-button
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue