Created
October 22, 2013 20:59
-
-
Save tobias/7108058 to your computer and use it in GitHub Desktop.
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 nrepl-port-from-file (file) | |
"Attempts to read port from a file named by FILE." | |
(let* ((dir (nrepl-project-directory-for (nrepl-current-dir))) | |
(f (expand-file-name file dir))) | |
(when (file-exists-p f) | |
(with-temp-buffer | |
(insert-file-contents f) | |
(buffer-string))))) | |
(defun nrepl-default-port () | |
"Attempt to read port from .nrepl-port or target/repl-port. | |
Falls back to `nrepl-port' if not found." | |
(or (nrepl-port-from-file ".nrepl-port") | |
(nrepl-port-from-file "target/repl-port") | |
nrepl-port)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment