diff options
| author | Glenn Morris | 2012-03-07 22:06:28 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-03-07 22:06:28 -0800 |
| commit | 9a40b8d45eaf5e9a335ae19b97d72489ea0a3f91 (patch) | |
| tree | 24066fb133585f12e0783ddbfc1521238f64d380 | |
| parent | 483ab23014e2879d1f83620cd27e1c5f7b3c3d46 (diff) | |
| download | emacs-9a40b8d45eaf5e9a335ae19b97d72489ea0a3f91.tar.gz emacs-9a40b8d45eaf5e9a335ae19b97d72489ea0a3f91.zip | |
Undo 2012-03-06T08:22:42Z!rgm@gnu.org
* lisp/files.el (locate-dominating-file, dir-locals-find-file):
Undo 2012-03-06 change.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/files.el | 32 |
2 files changed, 23 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 68b48f5047e..384aa8f89d9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-03-08 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * files.el (locate-dominating-file, dir-locals-find-file): | ||
| 4 | Undo 2012-03-06 change. | ||
| 5 | |||
| 1 | 2012-03-07 Eli Zaretskii <eliz@gnu.org> | 6 | 2012-03-07 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * international/quail.el (quail-help): Force | 8 | * international/quail.el (quail-help): Force |
diff --git a/lisp/files.el b/lisp/files.el index 1d54ef81869..fae834daefe 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -877,14 +877,13 @@ or mount points potentially requiring authentication as a different user.") | |||
| 877 | ;; (setq dir nil)))) | 877 | ;; (setq dir nil)))) |
| 878 | ;; nil))) | 878 | ;; nil))) |
| 879 | 879 | ||
| 880 | (defun locate-dominating-file (file name &optional predicate) | 880 | (defun locate-dominating-file (file name) |
| 881 | "Look up the directory hierarchy from FILE for a file named NAME. | 881 | "Look up the directory hierarchy from FILE for a file named NAME. |
| 882 | Stop at the first parent directory containing a file NAME, | 882 | Stop at the first parent directory containing a file NAME, |
| 883 | and return the directory. Return nil if not found. | 883 | and return the directory. Return nil if not found. |
| 884 | 884 | ||
| 885 | Optional argument PREDICATE is a function of one argument, a file. | 885 | This function only tests if FILE exists. If you care about whether |
| 886 | It should return non-nil if the file is acceptable. The default is | 886 | it is readable, regular, etc., you should test the result." |
| 887 | `file-exists-p'; you might, e.g., want to use `file-readable-p' instead." | ||
| 888 | ;; We used to use the above locate-dominating-files code, but the | 887 | ;; We used to use the above locate-dominating-files code, but the |
| 889 | ;; directory-files call is very costly, so we're much better off doing | 888 | ;; directory-files call is very costly, so we're much better off doing |
| 890 | ;; multiple calls using the code in here. | 889 | ;; multiple calls using the code in here. |
| @@ -911,8 +910,11 @@ It should return non-nil if the file is acceptable. The default is | |||
| 911 | ;; (setq user (nth 2 (file-attributes file))) | 910 | ;; (setq user (nth 2 (file-attributes file))) |
| 912 | ;; (and prev-user (not (equal user prev-user)))) | 911 | ;; (and prev-user (not (equal user prev-user)))) |
| 913 | (string-match locate-dominating-stop-dir-regexp file))) | 912 | (string-match locate-dominating-stop-dir-regexp file))) |
| 914 | (setq try (funcall (or predicate 'file-exists-p) | 913 | ;; FIXME? maybe this function should (optionally?) |
| 915 | (expand-file-name name file))) | 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. | ||
| 917 | (setq try (file-exists-p (expand-file-name name file))) | ||
| 916 | (cond (try (setq root file)) | 918 | (cond (try (setq root file)) |
| 917 | ((equal file (setq file (file-name-directory | 919 | ((equal file (setq file (file-name-directory |
| 918 | (directory-file-name file)))) | 920 | (directory-file-name file)))) |
| @@ -3550,7 +3552,7 @@ across different environments and users.") | |||
| 3550 | "Find the directory-local variables for FILE. | 3552 | "Find the directory-local variables for FILE. |
| 3551 | This searches upward in the directory tree from FILE. | 3553 | This searches upward in the directory tree from FILE. |
| 3552 | It stops at the first directory that has been registered in | 3554 | It stops at the first directory that has been registered in |
| 3553 | `dir-locals-directory-cache' or contains a readable `dir-locals-file'. | 3555 | `dir-locals-directory-cache' or contains a `dir-locals-file'. |
| 3554 | If it finds an entry in the cache, it checks that it is valid. | 3556 | If it finds an entry in the cache, it checks that it is valid. |
| 3555 | A cache entry with no modification time element (normally, one that | 3557 | A cache entry with no modification time element (normally, one that |
| 3556 | has been assigned directly using `dir-locals-set-directory-class', not | 3558 | has been assigned directly using `dir-locals-set-directory-class', not |
| @@ -3568,15 +3570,17 @@ of no valid cache entry." | |||
| 3568 | (if (eq system-type 'ms-dos) | 3570 | (if (eq system-type 'ms-dos) |
| 3569 | (dosified-file-name dir-locals-file) | 3571 | (dosified-file-name dir-locals-file) |
| 3570 | dir-locals-file)) | 3572 | dir-locals-file)) |
| 3571 | ;; FIXME? Is it right to silently ignore unreadable files? | 3573 | (locals-file (locate-dominating-file file dir-locals-file-name)) |
| 3572 | (locals-file (locate-dominating-file file dir-locals-file-name | ||
| 3573 | (lambda (file) | ||
| 3574 | (and (file-readable-p file) | ||
| 3575 | (file-regular-p file))))) | ||
| 3576 | (dir-elt nil)) | 3574 | (dir-elt nil)) |
| 3577 | ;; `locate-dominating-file' may have abbreviated the name. | 3575 | ;; `locate-dominating-file' may have abbreviated the name. |
| 3578 | (if locals-file | 3576 | (and locals-file |
| 3579 | (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)) | ||
| 3580 | ;; Find the best cached value in `dir-locals-directory-cache'. | 3584 | ;; Find the best cached value in `dir-locals-directory-cache'. |
| 3581 | (dolist (elt dir-locals-directory-cache) | 3585 | (dolist (elt dir-locals-directory-cache) |
| 3582 | (when (and (eq t (compare-strings file nil (length (car elt)) | 3586 | (when (and (eq t (compare-strings file nil (length (car elt)) |