aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-03-05 21:50:28 -0500
committerGlenn Morris2012-03-05 21:50:28 -0500
commit8f2114eef3d9efca0f5de7076a165d104c47fc1e (patch)
tree845b1fad7f84797eacc30a006bc7f6215b6cff9c
parenteb18244605c440f79caf2d46edad2734a438dbb7 (diff)
downloademacs-8f2114eef3d9efca0f5de7076a165d104c47fc1e.tar.gz
emacs-8f2114eef3d9efca0f5de7076a165d104c47fc1e.zip
dir-locals-find-file tweak for "odd" .dir-locals.el (bug#10928)
* lisp/files.el (dir-locals-find-file): Ignore non-readable or non-regular files.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/files.el14
2 files changed, 15 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 76166b50c0f..b4d5a146490 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12012-03-06 Glenn Morris <rgm@gnu.org> 12012-03-06 Glenn Morris <rgm@gnu.org>
2 2
3 * files.el (dir-locals-find-file):
4 Ignore non-readable or non-regular files. (Bug#10928)
5
3 * files.el (locate-dominating-file): Doc fix. 6 * files.el (locate-dominating-file): Doc fix.
4 7
52012-03-06 Adam Spiers <emacs@adamspiers.org> (tiny change) 82012-03-06 Adam Spiers <emacs@adamspiers.org> (tiny change)
diff --git a/lisp/files.el b/lisp/files.el
index d9a3e4b0f79..fae834daefe 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -910,6 +910,10 @@ it is readable, regular, etc., you should test the result."
910 ;; (setq user (nth 2 (file-attributes file))) 910 ;; (setq user (nth 2 (file-attributes file)))
911 ;; (and prev-user (not (equal user prev-user)))) 911 ;; (and prev-user (not (equal user prev-user))))
912 (string-match locate-dominating-stop-dir-regexp file))) 912 (string-match locate-dominating-stop-dir-regexp file)))
913 ;; FIXME? maybe this function should (optionally?)
914 ;; use file-readable-p instead. In many cases, an unreadable
915 ;; FILE is no better than a non-existent one.
916 ;; See eg dir-locals-find-file.
913 (setq try (file-exists-p (expand-file-name name file))) 917 (setq try (file-exists-p (expand-file-name name file)))
914 (cond (try (setq root file)) 918 (cond (try (setq root file))
915 ((equal file (setq file (file-name-directory 919 ((equal file (setq file (file-name-directory
@@ -3569,8 +3573,14 @@ of no valid cache entry."
3569 (locals-file (locate-dominating-file file dir-locals-file-name)) 3573 (locals-file (locate-dominating-file file dir-locals-file-name))
3570 (dir-elt nil)) 3574 (dir-elt nil))
3571 ;; `locate-dominating-file' may have abbreviated the name. 3575 ;; `locate-dominating-file' may have abbreviated the name.
3572 (if locals-file 3576 (and locals-file
3573 (setq locals-file (expand-file-name dir-locals-file-name locals-file))) 3577 (setq locals-file (expand-file-name dir-locals-file-name locals-file))
3578 ;; FIXME? is it right to silently ignore an unreadable file?
3579 ;; Maybe we'd want to keep searching in that case.
3580 ;; That is a locate-dominating-file issue.
3581 (or (not (file-readable-p locals-file))
3582 (not (file-regular-p locals-file)))
3583 (setq locals-file nil))
3574 ;; Find the best cached value in `dir-locals-directory-cache'. 3584 ;; Find the best cached value in `dir-locals-directory-cache'.
3575 (dolist (elt dir-locals-directory-cache) 3585 (dolist (elt dir-locals-directory-cache)
3576 (when (and (eq t (compare-strings file nil (length (car elt)) 3586 (when (and (eq t (compare-strings file nil (length (car elt))