Skip to content

Commit 250c147

Browse files
committed
make clojure-test-run-tests auto-jump to the test buffer if in the impl buffer
1 parent 08b87fe commit 250c147

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

clojure-test-mode.el

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -320,19 +320,21 @@ Retuns the problem overlay if such a position is found, otherwise nil."
320320
(interactive)
321321
(save-some-buffers nil (lambda () (equal major-mode 'clojure-mode)))
322322
(message "Testing...")
323-
(clojure-test-clear
324-
(lambda (&rest args)
325-
;; clojure-test-eval will wrap in with-out-str
326-
(slime-eval-async `(swank:load-file
327-
,(slime-to-lisp-filename
328-
(expand-file-name (buffer-file-name))))
329-
(lambda (&rest args)
330-
(slime-eval-async '(swank:interactive-eval
331-
"(binding [clojure.test/report
323+
(save-window-excursion
324+
(if (not (clojure-in-tests-p))
325+
(clojure-jump-to-test))
326+
(clojure-test-clear
327+
(lambda (&rest args)
328+
;; clojure-test-eval will wrap in with-out-str
329+
(slime-eval-async `(swank:load-file
330+
,(slime-to-lisp-filename
331+
(expand-file-name (buffer-file-name))))
332+
(lambda (&rest args)
333+
(slime-eval-async '(swank:interactive-eval
334+
"(binding [clojure.test/report
332335
clojure.test.mode/report]
333336
(clojure.test/run-tests))")
334-
#'clojure-test-get-results))))))
335-
337+
#'clojure-test-get-results)))))))
336338
(defun clojure-test-run-test ()
337339
"Run the test at point."
338340
(interactive)

0 commit comments

Comments
 (0)