diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 43bdd3e..ae9b8e9 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -162,11 +162,10 @@ "Set up the Python IDE in the current project" (interactive) (let ((venv-dir (find-venv))) - (if venv-dir + (when venv-dir (progn (pyvenv-activate venv-dir) - (lsp)) - (pyvenv-deactivate)))) + (lsp))))) (defun symbols-at-point () (let* ((lsp--document-symbols-request-async t) @@ -191,11 +190,13 @@ (filename (f-no-ext (f-filename (buffer-file-name))))) (string-join (append path (list filename) (python-test-at-point)) "."))) -(defun python-run-test-at-point () - (interactive) +(defun python-run-test-at-point (debug) + (interactive "P") (let ((python (executable-find "python")) (test-name (python-test-name-at-point))) - (compile (concat python " -m unittest " test-name)))) + (if debug + (pdb (concat python " -m pdb -m unittest " test-name)) + (compile (concat python " -m unittest " test-name))))) (use-package python :bind (:map python-mode-map