Skip to content

Commit 823fb4b

Browse files
committed
add clojure-in-tests-p and clojure-jump-between-tests-and-code
1 parent a6d8757 commit 823fb4b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

clojure-mode.el

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,9 @@ to specific the full path to it. The arguments are port, hostname."
10441044
(clojure-enable-slime))))))
10451045

10461046
;; Test navigation:
1047+
(defun clojure-in-tests-p ()
1048+
(or (string-match-p "test\." (clojure-find-ns))
1049+
(string-match-p "/test" (buffer-file-name))))
10471050

10481051
(defun clojure-underscores-for-hyphens (namespace)
10491052
(replace-regexp-in-string "-" "_" namespace))
@@ -1063,16 +1066,20 @@ to specific the full path to it. The arguments are port, hostname."
10631066
(locate-dominating-file buffer-file-name "src/")
10641067
(clojure-test-for (clojure-find-ns)))))
10651068

1069+
(defun clojure-jump-between-tests-and-code ()
1070+
(interactive)
1071+
(if (clojure-in-tests-p)
1072+
(clojure-test-jump-to-implementation)
1073+
(clojure-jump-to-test)))
1074+
10661075
;;; slime filename translation for tramp
10671076
(defun clojure-slime-tramp-local-filename (f)
1068-
;; (interactive)
10691077
(if (file-remote-p f)
10701078
(tramp-file-name-localname
10711079
(tramp-dissect-file-name f))
10721080
f))
10731081

10741082
(defun clojure-slime-tramp-remote-filename (f)
1075-
;; (interactive)
10761083
(if (file-remote-p default-directory)
10771084
(tramp-make-tramp-file-name
10781085
(tramp-file-name-method
@@ -1085,7 +1092,6 @@ to specific the full path to it. The arguments are port, hostname."
10851092
f))
10861093

10871094
(defun clojure-slime-remote-file-name-hook ()
1088-
;; (interactive)
10891095
(setq slime-from-lisp-filename-function
10901096
'slime-tramp-remote-filename)
10911097
(setq slime-to-lisp-filename-function

0 commit comments

Comments
 (0)