# HG changeset patch # User Stefan Monnier # Date 1184904548 0 # Node ID df7b7863742c2b395e50b3f3e1fd42129a56a766 # Parent f41d4ecf6cb43f9766fcc830b9d88d02feba8798 (flymake-buildfile-dirs): Remove. (flymake-find-buildfile): Use locate-dominating-file. diff -r f41d4ecf6cb4 -r df7b7863742c lisp/ChangeLog --- a/lisp/ChangeLog Fri Jul 20 04:00:37 2007 +0000 +++ b/lisp/ChangeLog Fri Jul 20 04:09:08 2007 +0000 @@ -1,5 +1,8 @@ 2007-07-20 Stefan Monnier + * progmodes/flymake.el (flymake-buildfile-dirs): Remove. + (flymake-find-buildfile): Use locate-dominating-file. + * vc.el (vc-delistify): Use mapconcat. (vc-do-command): Minor simplification. (vc-expand-dirs): Use push. diff -r f41d4ecf6cb4 -r df7b7863742c lisp/progmodes/flymake.el --- a/lisp/progmodes/flymake.el Fri Jul 20 04:00:37 2007 +0000 +++ b/lisp/progmodes/flymake.el Fri Jul 20 04:09:08 2007 +0000 @@ -325,11 +325,6 @@ (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) 'flymake-get-real-file-name)) -(defcustom flymake-buildfile-dirs '("." ".." "../.." "../../.." "../../../.." "../../../../.." "../../../../../.." "../../../../../../.." "../../../../../../../.." "../../../../../../../../.." "../../../../../../../../../.." "../../../../../../../../../../..") - "Dirs to look for buildfile." - :group 'flymake - :type '(repeat (string))) - (defvar flymake-find-buildfile-cache (flymake-makehash 'equal)) (defun flymake-get-buildfile-from-cache (dir-name) @@ -346,19 +341,15 @@ Buildfile includes Makefile, build.xml etc. Return its file name if found, or nil if not found." (or (flymake-get-buildfile-from-cache source-dir-name) - (let* ((dirs flymake-buildfile-dirs) - (buildfile-dir nil) - (found nil)) - (while (and (not found) dirs) - (setq buildfile-dir (concat source-dir-name (car dirs))) - (when (file-exists-p (expand-file-name buildfile-name buildfile-dir)) - (setq found t)) - (setq dirs (cdr dirs))) - (if found + (let* ((file (locate-dominating-file + source-dir-name + (concat "\\`" (regexp-quote buildfile-name) "\\'")))) + (if file (progn - (flymake-log 3 "found buildfile at %s/%s" buildfile-dir buildfile-name) - (flymake-add-buildfile-to-cache source-dir-name buildfile-dir) - buildfile-dir) + (flymake-log 3 "found buildfile at %s" file) + (setq file (file-name-directory file)) + (flymake-add-buildfile-to-cache source-dir-name file) + file) (progn (flymake-log 3 "buildfile for %s not found" source-dir-name) nil)))))