Created
August 26, 2011 11:06
-
-
Save ussy/1173199 to your computer and use it in GitHub Desktop.
Quick Scala Specs
This file contains 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
(defun my-quick-specs() | |
(interactive) | |
(if buffer-file-name | |
(cond | |
((string-match "^\\(.*?/src/\\)test\\(/scala/.+?/\\)\\(.+?\\)Spec\\.scala$" buffer-file-name) | |
(let* ((base-dir (match-string 1 buffer-file-name)) | |
(target-dir (match-string 2 buffer-file-name)) | |
(target-name (match-string 3 buffer-file-name)) | |
(target-path (concat base-dir "main" target-dir target-name ".scala"))) | |
(find-file target-path))) | |
((string-match "^\\(.*?/src/\\)main\\(/scala/.+?/\\)\\(.+?\\)\\.scala$" buffer-file-name) | |
(let* ((base-dir (match-string 1 buffer-file-name)) | |
(target-dir (match-string 2 buffer-file-name)) | |
(target-name (match-string 3 buffer-file-name)) | |
(target-path (concat base-dir "test" target-dir target-name "Spec.scala"))) | |
(find-file target-path)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment