Created
February 12, 2017 19:44
-
-
Save c-garcia/e4218c6ebe17afd2b06171128acb0728 to your computer and use it in GitHub Desktop.
Guess the file path of an emacs buffer holding a clojure file.
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 guess-clojure-test-file () | |
"Guesses the test file path of the current buffer if it is a clojure file." | |
(interactive) | |
(let ((clojure-file-name buffer-file-name)) | |
(with-temp-buffer | |
(insert clojure-file-name) | |
(goto-char (point-max)) | |
(search-backward "src") | |
(replace-match "test") | |
(goto-char (point-max)) | |
(search-backward ".") | |
(replace-match "_test.") | |
(message (buffer-string))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment