[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107537: Another dir-locals iteration
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107537: Another dir-locals iteration |
Date: |
Thu, 08 Mar 2012 22:21:49 -0500 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107537
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2012-03-08 22:21:49 -0500
message:
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.
modified:
lisp/ChangeLog
lisp/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-03-08 18:21:07 +0000
+++ b/lisp/ChangeLog 2012-03-09 03:21:49 +0000
@@ -1,3 +1,9 @@
+2012-03-09 Glenn Morris <address@hidden>
+
+ * files.el (dir-locals-find-file):
+ Don't check result is regular, readable.
+ (dir-locals-read-from-file): Demote errors.
+
2012-03-08 Eli Zaretskii <address@hidden>
* international/quail.el (quail-insert-kbd-layout): Insert
=== modified file 'lisp/files.el'
--- a/lisp/files.el 2012-03-08 06:06:28 +0000
+++ b/lisp/files.el 2012-03-09 03:21:49 +0000
@@ -3574,13 +3574,14 @@
(dir-elt nil))
;; `locate-dominating-file' may have abbreviated the name.
(and locals-file
- (setq locals-file (expand-file-name dir-locals-file-name locals-file))
- ;; FIXME? is it right to silently ignore an unreadable file?
- ;; Maybe we'd want to keep searching in that case.
- ;; That is a locate-dominating-file issue.
- (or (not (file-readable-p locals-file))
- (not (file-regular-p locals-file)))
- (setq locals-file nil))
+ (setq locals-file (expand-file-name dir-locals-file-name locals-file)))
+ ;; Let dir-locals-read-from-file inform us via demoted-errors
+ ;; about unreadable files, etc.
+ ;; Maybe we'd want to keep searching though - that is
+ ;; a locate-dominating-file issue.
+;;; (or (not (file-readable-p locals-file))
+;;; (not (file-regular-p locals-file)))
+;;; (setq locals-file nil))
;; Find the best cached value in `dir-locals-directory-cache'.
(dolist (elt dir-locals-directory-cache)
(when (and (eq t (compare-strings file nil (length (car elt))
@@ -3622,15 +3623,19 @@
The new class name is the same as the directory in which FILE
is found. Returns the new class name."
(with-temp-buffer
- (insert-file-contents file)
- (let* ((dir-name (file-name-directory file))
- (class-name (intern dir-name))
- (variables (let ((read-circle nil))
- (read (current-buffer)))))
- (dir-locals-set-class-variables class-name variables)
- (dir-locals-set-directory-class dir-name class-name
- (nth 5 (file-attributes file)))
- class-name)))
+ ;; Errors reading the file are not very informative.
+ ;; Eg just "Error: (end-of-file)" does not give any clue that the
+ ;; problem is related to dir-locals.
+ (with-demoted-errors
+ (insert-file-contents file)
+ (let* ((dir-name (file-name-directory file))
+ (class-name (intern dir-name))
+ (variables (let ((read-circle nil))
+ (read (current-buffer)))))
+ (dir-locals-set-class-variables class-name variables)
+ (dir-locals-set-directory-class dir-name class-name
+ (nth 5 (file-attributes file)))
+ class-name))))
(defun hack-dir-local-variables ()
"Read per-directory local variables for the current buffer.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107537: Another dir-locals iteration,
Glenn Morris <=