Skip to content

Instantly share code, notes, and snippets.

@bbatsov
Created July 19, 2010 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbatsov/481145 to your computer and use it in GitHub Desktop.
Save bbatsov/481145 to your computer and use it in GitHub Desktop.
(defun ffip-project-root ()
"Return the root of the project.
If `locate-dominating-file' is bound we use it directly - otherwise we use
a replacement for it. A list of project files is search for - the first
match is used to determine the root of the project."
(let ((project-files (copy-sequence ffip-project-files))
(project-root nil))
(while (or project-root project-files)
(message (car project-files))
(setq project-root (ffip-locate-dominating-file
default-directory
(car project-files)))
(message project-root)
(setq project-files (cdr project-files)))
(or project-root
(progn (message "No project is defined for the current file.")
nil)))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment