Skip to content

Instantly share code, notes, and snippets.

@jaycfields
Created March 29, 2013 17:50
Show Gist options
  • Save jaycfields/5272391 to your computer and use it in GitHub Desktop.
Save jaycfields/5272391 to your computer and use it in GitHub Desktop.
(defun find-java-src ()
(interactive)
(er/mark-word)
(let* ((project-root (locate-dominating-file (file-name-directory (buffer-file-name)) "project.clj"))
(the-str (buffer-substring-no-properties (region-beginning) (region-end))))
(if project-root
(progn
(grep-string-in the-str
(concat project-root "lib/sources"))
(switch-to-grep)
(sit-for 0.25)
(search-forward (concat (expand-file-name project-root) "lib/sources/"))
(compile-goto-error)
(let* ((current-point (point)))
(search-forward-regexp ".*\.jar")
(switch-to-buffer (buffer-substring-no-properties current-point (point))))
(search-forward the-str)
(archive-extract))
(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