summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-05-06 10:57:28 -0700
committerGlenn Morris <rgm@gnu.org>2012-05-06 10:57:28 -0700
commitfd075e7b2b248a4357af64e85e2cd3b87949fa23 (patch)
tree70eca29e338f2fb6619c01595d9cddb003b38d87 /lisp/files.el
parented39e4e24d031db7e994e743c1dc4d055aa8f8de (diff)
downloademacs-fd075e7b2b248a4357af64e85e2cd3b87949fa23.tar.gz
* files.el (dir-locals-read-from-file): Mention dir-locals in any error message.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el28
1 files changed, 15 insertions, 13 deletions
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.
The new class name is the same as the directory in which FILE
is found. Returns the new class name."
(with-temp-buffer
- ;; 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))))
+ ;; This is with-demoted-errors, but we want to mention dir-locals
+ ;; in any error message.
+ (let ((err (make-symbol "err")))
+ (condition-case err
+ (progn
+ (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))
+ (error (message "Error reading dir-locals: %S" err) nil)))))
(defun hack-dir-local-variables ()
"Read per-directory local variables for the current buffer.