[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/files.el,v
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/files.el,v |
Date: |
Sat, 16 Feb 2008 21:39:34 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 08/02/16 21:39:33
Index: files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.959
retrieving revision 1.960
diff -u -b -r1.959 -r1.960
--- files.el 30 Jan 2008 21:25:08 -0000 1.959
+++ files.el 16 Feb 2008 21:39:30 -0000 1.960
@@ -727,18 +727,22 @@
(defun locate-dominating-file (file regexp)
"Look up the directory hierarchy from FILE for a file matching REGEXP."
- (while (and file (not (file-directory-p file)))
- (setq file (file-name-directory (directory-file-name file))))
(catch 'found
- (let ((user (nth 2 (file-attributes file)))
+ ;; `user' is not initialized yet because `file' may not exist, so we may
+ ;; have to walk up part of the hierarchy before we find the "initial UID".
+ (let ((user nil)
;; Abbreviate, so as to stop when we cross ~/.
(dir (abbreviate-file-name (file-name-as-directory file)))
files)
- ;; As a heuristic, we stop looking up the hierarchy of directories as
- ;; soon as we find a directory belonging to another user. This should
- ;; save us from looking in things like /net and /afs. This assumes
- ;; that all the files inside a project belong to the same user.
- (while (and dir (equal user (nth 2 (file-attributes dir))))
+ (while (and dir
+ ;; As a heuristic, we stop looking up the hierarchy of
+ ;; directories as soon as we find a directory belonging to
+ ;; another user. This should save us from looking in
+ ;; things like /net and /afs. This assumes that all the
+ ;; files inside a project belong to the same user.
+ (let ((prev-user user))
+ (setq user (nth 2 (file-attributes file)))
+ (not (or (null prev-user) (equal user prev-user)))))
(if (setq files (directory-files dir 'full regexp))
(throw 'found (car files))
(if (equal dir
- [Emacs-diffs] Changes to emacs/lisp/files.el,v,
Stefan Monnier <=
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Stefan Monnier, 2008/02/18
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Miles Bader, 2008/02/24
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Chong Yidong, 2008/02/25
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Miles Bader, 2008/02/29