Added eproject-clear and eproject-repopulate methodsmob
authorAustin Bingham <austin.bingham@gmail.com>
Sat, 22 Oct 2011 06:07:36 +0000 (22 08:07 +0200)
committerAustin Bingham <austin.bingham@gmail.com>
Sat, 22 Oct 2011 06:07:36 +0000 (22 08:07 +0200)
eproject.el

index 3af8313..ad00d89 100644 (file)
@@ -1283,7 +1283,7 @@ for all project files (nil/t)."
   (interactive
    (list 
     (read-directory-name "Directory: " prj-directory)
-    (read-string "Pattern: " "*")))
+    (read-string "Pattern: " "")))
   (unless prj-current (error "No project open"))
 
   ; TODO: Verify that `dir` is under prj-directory? Is this required?
@@ -1292,5 +1292,36 @@ for all project files (nil/t)."
     (prj-walk-path dir
               (lambda (dir file) (prj-add-if p dir file)))))
 
+(defun eproject-repopulate ()
+  "Repopulate the project based on project-populate-spec."
+  (interactive)
+  (unless (prj-getconfig "project-populate-spec") (error "No project-populate-spec defined."))
+  (unless prj-directory (error "No prj-directory defined."))
+  (eproject-clear)
+  (let ((spec (eval (read (prj-getconfig "project-populate-spec")))))
+    (while spec
+                                        ; path is the current
+                                        ; project-relative
+                                        ; subdirectory
+      (setq path (caar spec))
+
+                                        ; patterns is the list of
+                                        ; patterns to populate with
+                                        ; from that path
+      (setq patterns (cdar spec))
+      (setq spec (cdr spec))
+      (while patterns
+        (setq pattern (car patterns))
+        (setq patterns (cdr patterns))
+
+                                        ; populate using the specified
+                                        ; path and pattern
+        (eproject-populate (concat prj-directory path) pattern)))))
+
+(defun eproject-clear ()
+  (interactive)
+  (unless prj-current (error "No project open"))
+  (setq prj-files nil))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; eproject.el ends here