Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor to a nicer way to extend the project roots

  • Loading branch information...
commit 6ad86eee284af991c0fe0e7369b730fd64c3778f 1 parent 2b34699
Irfan Shah irfn authored
Showing with 14 additions and 5 deletions.
  1. +1 −0  .gitignore
  2. +13 −5 textmate.el
1  .gitignore
View
@@ -0,0 +1 @@
+*.elc
18 textmate.el
View
@@ -249,13 +249,21 @@
(setq *textmate-project-root* nil))))
*textmate-project-root*)
+(defun root-match(root names)
+ (member (car names) (directory-files root)))
+
+(defun root-matches(root names)
+ (if (root-match root names)
+ (root-match root names)
+ (if (eq (length (cdr names)) 0)
+ 'nil
+ (root-matches root (cdr names))
+ )))
+
(defun textmate-find-project-root (&optional root)
(when (null root) (setq root default-directory))
(cond
- ((or
- (member ".git" (directory-files root))
- (member "Rakefile" (directory-files root))
- (member "Makefile" (directory-files root)))
+ ((root-matches root '(".git" "Rakefile" "Makefile" "README" "build.xml"))
(expand-file-name root))
((equal (expand-file-name root) "/") nil)
(t (textmate-find-project-root (concat (file-name-as-directory root) "..")))))
@@ -290,4 +298,4 @@ A place is considered `tab-width' character columns."
(funcall (cadr mode) -1)))))
(provide 'textmate)
-;;; textmate.el ends here
+;;; textmate.el ends here
Please sign in to comment.
Something went wrong with that request. Please try again.