diff options
| author | Glenn Morris | 2012-03-08 22:21:49 -0500 |
|---|---|---|
| committer | Glenn Morris | 2012-03-08 22:21:49 -0500 |
| commit | f7fd3d79b702f5fc1211d0d3d104455b7bf04407 (patch) | |
| tree | 31c8fd6269f47bc2dd39bfa0008b242f11e56d3f | |
| parent | 89c94350a4e24074150e62f7d443c9b6902ed13b (diff) | |
| download | emacs-f7fd3d79b702f5fc1211d0d3d104455b7bf04407.tar.gz emacs-f7fd3d79b702f5fc1211d0d3d104455b7bf04407.zip | |
Another dir-locals iteration
* lisp/files.el (dir-locals-find-file):
Don't check result is regular, readable.
(dir-locals-read-from-file): Demote errors.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/files.el | 37 |
2 files changed, 27 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0e931572f01..db93ab69876 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-03-09 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * files.el (dir-locals-find-file): | ||
| 4 | Don't check result is regular, readable. | ||
| 5 | (dir-locals-read-from-file): Demote errors. | ||
| 6 | |||
| 1 | 2012-03-08 Eli Zaretskii <eliz@gnu.org> | 7 | 2012-03-08 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * international/quail.el (quail-insert-kbd-layout): Insert | 9 | * international/quail.el (quail-insert-kbd-layout): Insert |
diff --git a/lisp/files.el b/lisp/files.el index fae834daefe..cde15c5d0b1 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3574,13 +3574,14 @@ of no valid cache entry." | |||
| 3574 | (dir-elt nil)) | 3574 | (dir-elt nil)) |
| 3575 | ;; `locate-dominating-file' may have abbreviated the name. | 3575 | ;; `locate-dominating-file' may have abbreviated the name. |
| 3576 | (and locals-file | 3576 | (and locals-file |
| 3577 | (setq locals-file (expand-file-name dir-locals-file-name locals-file)) | 3577 | (setq locals-file (expand-file-name dir-locals-file-name locals-file))) |
| 3578 | ;; FIXME? is it right to silently ignore an unreadable file? | 3578 | ;; Let dir-locals-read-from-file inform us via demoted-errors |
| 3579 | ;; Maybe we'd want to keep searching in that case. | 3579 | ;; about unreadable files, etc. |
| 3580 | ;; That is a locate-dominating-file issue. | 3580 | ;; Maybe we'd want to keep searching though - that is |
| 3581 | (or (not (file-readable-p locals-file)) | 3581 | ;; a locate-dominating-file issue. |
| 3582 | (not (file-regular-p locals-file))) | 3582 | ;;; (or (not (file-readable-p locals-file)) |
| 3583 | (setq locals-file nil)) | 3583 | ;;; (not (file-regular-p locals-file))) |
| 3584 | ;;; (setq locals-file nil)) | ||
| 3584 | ;; Find the best cached value in `dir-locals-directory-cache'. | 3585 | ;; Find the best cached value in `dir-locals-directory-cache'. |
| 3585 | (dolist (elt dir-locals-directory-cache) | 3586 | (dolist (elt dir-locals-directory-cache) |
| 3586 | (when (and (eq t (compare-strings file nil (length (car elt)) | 3587 | (when (and (eq t (compare-strings file nil (length (car elt)) |
| @@ -3622,15 +3623,19 @@ FILE is the name of the file holding the variables to apply. | |||
| 3622 | The new class name is the same as the directory in which FILE | 3623 | The new class name is the same as the directory in which FILE |
| 3623 | is found. Returns the new class name." | 3624 | is found. Returns the new class name." |
| 3624 | (with-temp-buffer | 3625 | (with-temp-buffer |
| 3625 | (insert-file-contents file) | 3626 | ;; Errors reading the file are not very informative. |
| 3626 | (let* ((dir-name (file-name-directory file)) | 3627 | ;; Eg just "Error: (end-of-file)" does not give any clue that the |
| 3627 | (class-name (intern dir-name)) | 3628 | ;; problem is related to dir-locals. |
| 3628 | (variables (let ((read-circle nil)) | 3629 | (with-demoted-errors |
| 3629 | (read (current-buffer))))) | 3630 | (insert-file-contents file) |
| 3630 | (dir-locals-set-class-variables class-name variables) | 3631 | (let* ((dir-name (file-name-directory file)) |
| 3631 | (dir-locals-set-directory-class dir-name class-name | 3632 | (class-name (intern dir-name)) |
| 3632 | (nth 5 (file-attributes file))) | 3633 | (variables (let ((read-circle nil)) |
| 3633 | class-name))) | 3634 | (read (current-buffer))))) |
| 3635 | (dir-locals-set-class-variables class-name variables) | ||
| 3636 | (dir-locals-set-directory-class dir-name class-name | ||
| 3637 | (nth 5 (file-attributes file))) | ||
| 3638 | class-name)))) | ||
| 3634 | 3639 | ||
| 3635 | (defun hack-dir-local-variables () | 3640 | (defun hack-dir-local-variables () |
| 3636 | "Read per-directory local variables for the current buffer. | 3641 | "Read per-directory local variables for the current buffer. |