Created
January 15, 2011 21:51
-
-
Save dburger/781303 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(global-set-key "\C-ct" 'toggle-test) | |
(defun toggle-test () | |
(interactive) | |
(let* ((file-name (buffer-file-name)) | |
(toggle-file-name | |
(cond ((string-match "\\(.*\\)/javatests/\\(.*\\)\\(/[^/]*\\)Test.java$" file-name) | |
(concat (match-string 1 file-name) | |
"/java/" | |
(match-string 2 file-name) | |
(match-string 3 file-name) | |
".java")) | |
((string-match "\\(.*\\)/java/\\(.*\\)\\(/[^/]*\\).java$" file-name) | |
(concat (match-string 1 file-name) | |
"/javatests/" | |
(match-string 2 file-name) | |
(match-string 3 file-name) | |
"Test.java"))))) | |
(if toggle-file-name | |
(find-file toggle-file-name) | |
(message "Unable to determine the toggle-test file.")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment