From 2fc9c594df30fdad019fafee127d176809957762 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 8 Apr 2019 08:39:38 -0700 Subject: [emacs] Add a function for python's checker. --- emacs.d/custom/fcuny-defuns.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'emacs.d') 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) -- cgit 1.4.1