Skip to content

Instantly share code, notes, and snippets.

@jaycfields
Created November 3, 2012 17:20
Show Gist options
  • Save jaycfields/4008006 to your computer and use it in GitHub Desktop.
Save jaycfields/4008006 to your computer and use it in GitHub Desktop.
(defun test-full-path (project-root test-home)
(concat
(replace-regexp-in-string
(concat (expand-file-name project-root) "src/clojure")
(concat project-root test-home)
(file-name-sans-extension (buffer-file-name)))
"_expectations.clj"))
(defun find-expectations ()
(interactive)
(let* ((project-root (locate-dominating-file
(file-name-directory (buffer-file-name)) "project.clj")))
(if project-root
(let* ((full-path-with-clojure (test-full-path project-root
"test/clojure/expectations")))
(if (file-exists-p full-path-with-clojure)
(set-window-buffer (next-window) (find-file-noselect full-path-with-clojure))
(message (concat "cound not find " full-path-with-clojure))))
(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