Created
June 1, 2010 12:51
-
-
Save remvee/420911 to your computer and use it in GitHub Desktop.
launch lein swank and connect with slime
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
| ;; easy lein swanking | |
| (defun lein-swank () | |
| (interactive) | |
| (shell-command "lein swank&" "*lein-swank*") | |
| (with-current-buffer "*lein-swank*" | |
| (let ((timeout 10)) | |
| (while (and (> timeout 0) | |
| (not (progn (goto-char (point-min)) | |
| (search-forward-regexp "Connection opened on local port +\\([0-9]+\\)" nil t))) | |
| (not (progn (goto-char (point-min)) | |
| (search-forward "No project.clj found" nil t)))) | |
| (message "Waiting for swank ..%s.." timeout) | |
| (sleep-for 1) | |
| (decf timeout)) | |
| (let ((port (match-string 1))) | |
| (if port | |
| (progn | |
| (goto-char (point-min)) | |
| (search-forward-regexp "Connection opened on local port +\\([0-9]+\\)") | |
| (slime-connect "localhost" (match-string 1))) | |
| (message "No swank found..")))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment