emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103416: Yet more directory-local var


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103416: Yet more directory-local variables fixes.
Date: Thu, 24 Feb 2011 00:45:25 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103416
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2011-02-24 00:45:25 -0800
message:
  Yet more directory-local variables fixes.
  
  * lisp/files-x.el (modify-dir-local-variable): Handle dir-locals from
  the cache, and from non-file sources.
modified:
  lisp/ChangeLog
  lisp/files-x.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-02-24 08:26:25 +0000
+++ b/lisp/ChangeLog    2011-02-24 08:45:25 +0000
@@ -1,5 +1,8 @@
 2011-02-24  Glenn Morris  <address@hidden>
 
+       * files-x.el (modify-dir-local-variable): Handle dir-locals from
+       the cache, and from non-file sources.
+
        * help-fns.el (describe-variable): Return consistent results when a
        dir-local from a file came from the cache or did not.  (Bug#8095)
        If a dir-local has no associated file, say it came from a "directory".

=== modified file 'lisp/files-x.el'
--- a/lisp/files-x.el   2011-01-25 04:08:28 +0000
+++ b/lisp/files-x.el   2011-02-24 08:45:25 +0000
@@ -360,18 +360,28 @@
   (catch 'exit
     (unless enable-local-variables
       (throw 'exit (message "Directory-local variables are disabled")))
-
     (let ((variables-file (or (and (buffer-file-name)
                                   (not (file-remote-p (buffer-file-name)))
                                   (dir-locals-find-file (buffer-file-name)))
                              dir-locals-file))
          variables)
-
+      (if (consp variables-file)       ; result from cache
+         ;; If cache element has an mtime, assume it came from a file.
+         ;; Otherwise, assume it was set directly.
+         (setq variables-file (if (nth 2 variables-file)
+                                  (expand-file-name dir-locals-file
+                                                    (car variables-file))
+                                (cadr variables-file))))
+      ;; I can't be bothered to handle this case right now.
+      ;; Dir locals were set directly from a class.  You need to
+      ;; directly modify the class in dir-locals-class-alist.
+      (and variables-file (not (stringp variables-file))
+          (throw 'exit (message "Directory locals were not set from a file")))
       ;; Don't create ".dir-locals.el" for the deletion operation.
-      (when (and (eq op 'delete)
-                (not (file-exists-p variables-file)))
-       (throw 'exit (message "File .dir-locals.el not found")))
-
+      (and (eq op 'delete)
+          (or (not variables-file)
+              (not (file-exists-p variables-file)))
+          (throw 'exit (message "No .dir-locals.el file was found")))
       (let ((auto-insert nil))
        (find-file variables-file))
       (widen)


reply via email to

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