aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-05-06 10:57:28 -0700
committerGlenn Morris2012-05-06 10:57:28 -0700
commitfd075e7b2b248a4357af64e85e2cd3b87949fa23 (patch)
tree70eca29e338f2fb6619c01595d9cddb003b38d87
parented39e4e24d031db7e994e743c1dc4d055aa8f8de (diff)
downloademacs-fd075e7b2b248a4357af64e85e2cd3b87949fa23.tar.gz
emacs-fd075e7b2b248a4357af64e85e2cd3b87949fa23.zip
* files.el (dir-locals-read-from-file): Mention dir-locals in any error message.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el28
2 files changed, 20 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ad22a25cfd7..f559acb2ecc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-05-06 Glenn Morris <rgm@gnu.org>
2
3 * files.el (dir-locals-read-from-file):
4 Mention dir-locals in any error message.
5
12012-05-06 Chong Yidong <cyd@gnu.org> 62012-05-06 Chong Yidong <cyd@gnu.org>
2 7
3 * emacs-lisp/package.el (package-built-in-p): Handle the `emacs' 8 * emacs-lisp/package.el (package-built-in-p): Handle the `emacs'
diff --git a/lisp/files.el b/lisp/files.el
index 8df2942195e..6a91129dd1c 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3623,19 +3623,21 @@ FILE is the name of the file holding the variables to apply.
3623The new class name is the same as the directory in which FILE 3623The new class name is the same as the directory in which FILE
3624is found. Returns the new class name." 3624is found. Returns the new class name."
3625 (with-temp-buffer 3625 (with-temp-buffer
3626 ;; Errors reading the file are not very informative. 3626 ;; This is with-demoted-errors, but we want to mention dir-locals
3627 ;; Eg just "Error: (end-of-file)" does not give any clue that the 3627 ;; in any error message.
3628 ;; problem is related to dir-locals. 3628 (let ((err (make-symbol "err")))
3629 (with-demoted-errors 3629 (condition-case err
3630 (insert-file-contents file) 3630 (progn
3631 (let* ((dir-name (file-name-directory file)) 3631 (insert-file-contents file)
3632 (class-name (intern dir-name)) 3632 (let* ((dir-name (file-name-directory file))
3633 (variables (let ((read-circle nil)) 3633 (class-name (intern dir-name))
3634 (read (current-buffer))))) 3634 (variables (let ((read-circle nil))
3635 (dir-locals-set-class-variables class-name variables) 3635 (read (current-buffer)))))
3636 (dir-locals-set-directory-class dir-name class-name 3636 (dir-locals-set-class-variables class-name variables)
3637 (nth 5 (file-attributes file))) 3637 (dir-locals-set-directory-class dir-name class-name
3638 class-name)))) 3638 (nth 5 (file-attributes file)))
3639 class-name))
3640 (error (message "Error reading dir-locals: %S" err) nil)))))
3639 3641
3640(defun hack-dir-local-variables () 3642(defun hack-dir-local-variables ()
3641 "Read per-directory local variables for the current buffer. 3643 "Read per-directory local variables for the current buffer.