summary refs log tree commit diff
path: root/emacs.d
diff options
context:
space:
mode:
authorFranck Cuny <franckcuny@gmail.com>2016-03-10 19:49:33 -0800
committerFranck Cuny <franckcuny@gmail.com>2016-03-10 19:49:33 -0800
commit1162291ef0a32c1af3142738119133d5fb46d18b (patch)
tree1878385f82371af7785ad712886b5a98ee90a121 /emacs.d
parent[emacs] Rename a couple of functions (diff)
downloademacs.d-1162291ef0a32c1af3142738119133d5fb46d18b.tar.gz
[emacs] Remove code to support pants.
This is now in it's own repository.
Diffstat (limited to 'emacs.d')
-rw-r--r--emacs.d/core/core-pants.el73
1 files changed, 10 insertions, 63 deletions
diff --git a/emacs.d/core/core-pants.el b/emacs.d/core/core-pants.el
index af3b35d..cc9a93e 100644
--- a/emacs.d/core/core-pants.el
+++ b/emacs.d/core/core-pants.el
@@ -1,65 +1,12 @@
-;; this functions are to make it easy to work with `pants'
-
-(defvar fcuny/build-command "cd ~/src/source && ./pants --no-colors"
-  "Command to use to execute the target")
-
-(defvar fcuny/build-file "BUILD"
-  "Name of the file containing our build targets")
-
-(defun fcuny/--find-directory-containing-build-file (file)
-  "Find the directory containing the build file."
-  (let ((root nil)
-        try)
-    (while (not (or root
-                    (null file)
-                    (string-match locate-dominating-stop-dir-regexp file)))
-      (setq try (if (stringp fcuny/build-file)
-                    (file-exists-p (expand-file-name fcuny/build-file file))))
-      (cond (try (setq root file))
-            ((equal file (setq file (file-name-directory
-                                     (directory-file-name file))))
-             (setq file nil))))
-    (and root (expand-file-name (file-name-as-directory root)))))
-
-(defun fcuny/--build-action (target)
-  (compile (format "%s binary %s" fcuny/build-command target)))
-
-(defun fcuny/--build-target-list (file)
-  "Generate a list of existing targets"
-  (let ((build-command (format "%s list %s:" fcuny/build-command file))
-        targets target)
-    (with-temp-buffer
-      (insert
-       (shell-command-to-string build-command))
-      (goto-char (point-min))
-      (while (re-search-forward "^\\(.+\\)$" nil t)
-        (setq target (match-string 1))
-        (unless (or (save-excursion
-                      (goto-char (match-beginning 0))
-                      (forward-line -1)
-                      (looking-at "^# Not a target:"))
-                    (string-match "^\\." target))
-          (push target targets))))
-    (helm
-     (helm :sources
-           `((name . "Targets")
-             (candidates . ,targets)
-             (action . fcuny/--build-action))))))
-
-(defun fcuny/find-build-file ()
-  "Find the build file and if it exists, open it."
-  (interactive)
-  (let ((build-file (fcuny/--find-directory-containing-build-file (file-name-directory (buffer-file-name)))))
-    (if build-file
-        (find-file (concat build-file fcuny/build-file))
-      (error "Could not find %s" fcuny/build-file))))
-
-(defun fcuny/build-run-target ()
-  "List the targets for a BUILD file."
-  (interactive)
-  (let ((build-file (fcuny/--find-directory-containing-build-file (file-name-directory (buffer-file-name)))))
-    (if build-file
-        (fcuny/--build-target-list build-file)
-      (error "Could not find %s" fcuny/build-file))))
+(load-file "~/src/pants.el/pants.el")
+
+(use-package pants
+  :bind (("C-c b" . pants-find-build-file)
+         ("C-c r" . pants-run-binary)
+         ("C-c t" . pants-run-test))
+  :config
+  (progn
+    (setq pants-source-tree-root "/Users/fcuny/src/source"
+          pants-bury-compilation-buffer t)))
 
 (provide 'core-pants)