summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <fcuny@twitter.com>2019-04-08 08:39:38 -0700
committerFranck Cuny <fcuny@twitter.com>2019-04-08 08:39:38 -0700
commit2fc9c594df30fdad019fafee127d176809957762 (patch)
tree8fc8d452ab59557c97529f0278f6fab2d52af104
parent[Emacs] Not sure how transient works yet. (diff)
downloademacs.d-2fc9c594df30fdad019fafee127d176809957762.tar.gz
[emacs] Add a function for python's checker.
-rw-r--r--emacs.d/custom/fcuny-defuns.el18
1 files changed, 14 insertions, 4 deletions
diff --git a/emacs.d/custom/fcuny-defuns.el b/emacs.d/custom/fcuny-defuns.el
index 872f622..47d0a00 100644
--- a/emacs.d/custom/fcuny-defuns.el
+++ b/emacs.d/custom/fcuny-defuns.el
@@ -17,11 +17,10 @@
                (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name))))))))
 
 (defun fcuny/remove-mysql-columns ()
-  "Removes | from text. This is useful when I want to drop the column separator from some text coming from a mysql query."
+  "Removes from text. This is useful when I want to drop the column separator from some text coming from a mysql query."
   (interactive)
-  (if (region-active-p)
-      (replace-regexp "\s?|\s?" "" nil (region-beginning) (region-end))
-    (replace-regexp "\s?|\s?" "")))
+  (while (search-forward-regexp "\s?|\s?")
+    (replace-match " ")))
 
 (defun fcuny/copy-whole-buffer ()
   "Selects the buffer and copy it."
@@ -39,4 +38,15 @@
        (buffer-file-name)
        (string-match "src/source/.*\.py$" (buffer-file-name))))
 
+(defun fcuny/build-python-checker ()
+  "Compiles a newer version of the checker for Python."
+  (interactive)
+  (let ((output (make-temp-file "checker-foo"))
+        (errors (make-temp-file "checker-errors"))
+        (default-directory "~/workspace/source"))
+    (let ((status (call-process "~/workspace/source/pants" nil `(,output ,errors) nil "-q" "binary" "src/python/twitter/devprod/checkstyle:check")))
+      (if (zerop status)
+          (message "Built check.pex successfully")
+        (message (buffer-file-name output))))))
+
 (provide 'fcuny-defuns)