Mercurial > emacs
diff lisp/files.el @ 90988:492971a3f31f unicode-xft-base
Merge from emacs--devo--0
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
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 24 Jul 2007 01:23:55 +0000 |
parents | a1be62cbd32a 7620cd626c41 |
children | f55f9811f5d7 |
line wrap: on
line diff
--- a/lisp/files.el Mon Jul 23 05:39:31 2007 +0000 +++ b/lisp/files.el Tue Jul 24 01:23:55 2007 +0000 @@ -711,6 +711,28 @@ ((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 @@ mode-line-mule-info mode-line-position mode-line-process + mode-line-remote mode-name outline-level overriding-local-map