aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2011-02-24 00:45:25 -0800
committerGlenn Morris2011-02-24 00:45:25 -0800
commit6a88f031c8a895c87143da01201502e966aa7641 (patch)
tree2646f7cd332679c445763dfe7024454fc763e9ca
parent303f9ae0146c9bc42985e98a07b86be0cb1c6eca (diff)
downloademacs-6a88f031c8a895c87143da01201502e966aa7641.tar.gz
emacs-6a88f031c8a895c87143da01201502e966aa7641.zip
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.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/files-x.el22
2 files changed, 19 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 05bddd0a7d9..c44c491cad0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12011-02-24 Glenn Morris <rgm@gnu.org> 12011-02-24 Glenn Morris <rgm@gnu.org>
2 2
3 * files-x.el (modify-dir-local-variable): Handle dir-locals from
4 the cache, and from non-file sources.
5
3 * help-fns.el (describe-variable): Return consistent results when a 6 * help-fns.el (describe-variable): Return consistent results when a
4 dir-local from a file came from the cache or did not. (Bug#8095) 7 dir-local from a file came from the cache or did not. (Bug#8095)
5 If a dir-local has no associated file, say it came from a "directory". 8 If a dir-local has no associated file, say it came from a "directory".
diff --git a/lisp/files-x.el b/lisp/files-x.el
index a3cb5331e67..a9c32477155 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -360,18 +360,28 @@ from the MODE alist ignoring the input argument VALUE."
360 (catch 'exit 360 (catch 'exit
361 (unless enable-local-variables 361 (unless enable-local-variables
362 (throw 'exit (message "Directory-local variables are disabled"))) 362 (throw 'exit (message "Directory-local variables are disabled")))
363
364 (let ((variables-file (or (and (buffer-file-name) 363 (let ((variables-file (or (and (buffer-file-name)
365 (not (file-remote-p (buffer-file-name))) 364 (not (file-remote-p (buffer-file-name)))
366 (dir-locals-find-file (buffer-file-name))) 365 (dir-locals-find-file (buffer-file-name)))
367 dir-locals-file)) 366 dir-locals-file))
368 variables) 367 variables)
369 368 (if (consp variables-file) ; result from cache
369 ;; If cache element has an mtime, assume it came from a file.
370 ;; Otherwise, assume it was set directly.
371 (setq variables-file (if (nth 2 variables-file)
372 (expand-file-name dir-locals-file
373 (car variables-file))
374 (cadr variables-file))))
375 ;; I can't be bothered to handle this case right now.
376 ;; Dir locals were set directly from a class. You need to
377 ;; directly modify the class in dir-locals-class-alist.
378 (and variables-file (not (stringp variables-file))
379 (throw 'exit (message "Directory locals were not set from a file")))
370 ;; Don't create ".dir-locals.el" for the deletion operation. 380 ;; Don't create ".dir-locals.el" for the deletion operation.
371 (when (and (eq op 'delete) 381 (and (eq op 'delete)
372 (not (file-exists-p variables-file))) 382 (or (not variables-file)
373 (throw 'exit (message "File .dir-locals.el not found"))) 383 (not (file-exists-p variables-file)))
374 384 (throw 'exit (message "No .dir-locals.el file was found")))
375 (let ((auto-insert nil)) 385 (let ((auto-insert nil))
376 (find-file variables-file)) 386 (find-file variables-file))
377 (widen) 387 (widen)