Created
November 3, 2012 17:23
-
-
Save jaycfields/4008015 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
(defun src-full-path (project-root file-name) | |
(concat | |
(replace-regexp-in-string | |
(concat (expand-file-name project-root) "test/clojure/expectations") | |
(concat project-root "src/clojure") | |
(file-name-directory file-name)) | |
(replace-regexp-in-string | |
"_expectations" | |
"" | |
(file-name-nondirectory file-name)))) | |
(defun find-src () | |
(interactive) | |
(let* ((project-root (locate-dominating-file | |
(file-name-directory (buffer-file-name)) "project.clj"))) | |
(if project-root | |
(let* ((full-path (src-full-path project-root (buffer-file-name)))) | |
(if (file-exists-p full-path) | |
(set-window-buffer (next-window) (find-file-noselect full-path)) | |
(message (concat "cound not find " full-path)))) | |
(message (concat "no project.clj found at or below " (buffer-file-name)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment