emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r107977: * files.el (dir-locals-re


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r107977: * files.el (dir-locals-read-from-file): Mention dir-locals in any error message.
Date: Sun, 06 May 2012 10:57:28 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107977
committer: Glenn Morris <address@hidden>
branch nick: emacs-24
timestamp: Sun 2012-05-06 10:57:28 -0700
message:
  * files.el (dir-locals-read-from-file): Mention dir-locals in any error 
message.
modified:
  lisp/ChangeLog
  lisp/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-05-06 04:05:43 +0000
+++ b/lisp/ChangeLog    2012-05-06 17:57:28 +0000
@@ -1,3 +1,8 @@
+2012-05-06  Glenn Morris  <address@hidden>
+
+       * files.el (dir-locals-read-from-file):
+       Mention dir-locals in any error message.
+
 2012-05-06  Chong Yidong  <address@hidden>
 
        * emacs-lisp/package.el (package-built-in-p): Handle the `emacs'

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2012-04-10 07:13:54 +0000
+++ b/lisp/files.el     2012-05-06 17:57:28 +0000
@@ -3623,19 +3623,21 @@
 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]