From e38b769d324cc3ae56dff19689fdd7c47441b4fe Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 1 Feb 2014 16:10:59 -0500 Subject: Use prefix argument to choose py.test{,2} compile --- lisp/init-python.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lisp') diff --git a/lisp/init-python.el b/lisp/init-python.el index bbd477b..48bbf6d 100644 --- a/lisp/init-python.el +++ b/lisp/init-python.el @@ -25,14 +25,16 @@ Unless a prefix argument ARG is given, py.test is also imported." (unless arg (insert "import pytest\n"))))) +(defun km/pytest-compile (arg) + "Run pytest. +If ARG, use pytest2 instead of pytest." + (interactive "P") + (let ((pytest (if arg "py.test2" "py.test"))) + (compile pytest))) + (defun km/python-hook () (local-set-key (kbd "C-c m c") 'km/create-python-test-file) - (local-set-key (kbd "C-c m t") '(lambda () - (interactive) - (compile "py.test"))) - (local-set-key (kbd "C-c m T") '(lambda () - (interactive) - (compile "py.test2")))) + (local-set-key (kbd "C-c m t") 'km/pytest-compile)) (add-hook 'python-mode-hook 'km/python-hook) -- cgit v1.2.3