diff options
author | Miles Bader <miles@gnu.org> | 2007-07-24 01:23:55 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2007-07-24 01:23:55 +0000 |
commit | 40f9398cdba874aa72fd1828534110caa34702be (patch) | |
tree | ba7af35a2e0a913ccb78095d130ec695e6bfeb97 /lisp/files.el | |
parent | 22110b82771c73e38e4c637b90c5d01da3671c24 (diff) | |
parent | ccb0797a191047816dae47b2e0e7e751027bd0e8 (diff) | |
download | emacs-unicode-xft-base.tar.gz |
Merge from emacs--devo--0unicode-xft-base
Patches applied:
* emacs--devo--0 (patch 816-823)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 59-69)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 237-238)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-235
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el index ed76e16b183..f89ea85f2cc 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -711,6 +711,28 @@ PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)." ((null action) (try-completion string names)) (t (test-completion string names)))))) +(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))) + ;; 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)))) + (if (setq files (directory-files dir 'full regexp)) + (throw 'found (car files)) + (if (equal dir + (setq dir (file-name-directory + (directory-file-name dir)))) + (setq dir nil)))) + nil))) + (defun executable-find (command) "Search for COMMAND in `exec-path' and return the absolute file name. Return nil if COMMAND is not found anywhere in `exec-path'." @@ -2464,6 +2486,7 @@ asking you for confirmation." mode-line-mule-info mode-line-position mode-line-process + mode-line-remote mode-name outline-level overriding-local-map |