diff options
Diffstat (limited to 'prog/jao-dominating-file.el')
-rw-r--r-- | prog/jao-dominating-file.el | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/prog/jao-dominating-file.el b/prog/jao-dominating-file.el deleted file mode 100644 index f845abc..0000000 --- a/prog/jao-dominating-file.el +++ /dev/null @@ -1,34 +0,0 @@ -(defun jao-locate-dominating-files (regexp &optional file) - "Look up the directory hierarchy from FILE for a file matching REGEXP. - Stop at the first parent where a matching file is found and return the list - of files that that match in this directory." - (catch 'found - (let ((dir (file-name-as-directory (or file (buffer-file-name)))) - files) - (while (and dir - (not (string-match locate-dominating-stop-dir-regexp - dir))) - (if (setq files (condition-case nil - (directory-files dir 'full regexp 'nosort) - (error nil))) - (throw 'found files) - (if (equal dir - (setq dir (file-name-directory - (directory-file-name dir)))) - (setq dir nil)))) - nil))) - - -(defun jao-locate-dominating-file (regexp &optional from) - (car (jao-locate-dominating-files regexp from))) - -(defun jao-relative-path (regexp &optional from) - (let* ((from (or from (buffer-file-name))) - (dfile (jao-locate-dominating-file regexp from)) - (ddir (and dfile (file-name-directory dfile))) - (fdir (file-name-directory from))) - (when ddir - (and (string-match (format "%s\\(.+\\)/" (regexp-quote ddir)) fdir) - (match-string-no-properties 1 fdir))))) - -(provide 'jao-dominating-file) |