Anonymous avatar Anonymous committed 9c65857

Fix Moritz H.'s make-slime-connect function

It now works as expected when the repl-buffer was killed by the user

Cherry picked from git://github.com/the-kenny/.emacs.d.git commit
960ac419ac65dab59c93d4f34a8090052b2dfa48

Comments (0)

Files changed (1)

      (add-hook 'slime-mode-hook 'set-up-slime-hippie-expand)
      (add-hook 'slime-repl-mode-hook 'set-up-slime-hippie-expand)))
 
-(defun make-slime-connector (port)
-  (lexical-let ((port port))
-    (lambda ()
-      (interactive)
-      (let ((conn (find port
-                        slime-net-processes
-                        :test (lambda (port conn)
-                                (= port (slime-connection-port conn))))))
-        (if conn
-            (progn
-              (slime-select-connection conn)
-              (pop-to-buffer (slime-repl-buffer))
-              (message "Lisp: %s %s"
-                       (slime-connection-name conn)
-                       (process-contact conn)))
-          (slime-connect "localhost" port))))))
+(when (require 'slime nil 'noerror)
+  (defun make-slime-connector (port)
+    (lexical-let ((port port))
+      (lambda ()
+        (interactive)
+        (let ((conn (find port
+                          slime-net-processes
+                          :test (lambda (port conn)
+                                  (= port (slime-connection-port conn))))))
+          (if conn
+              (progn
+                (slime-select-connection conn)
+                (slime-repl)
+                (message "Lisp: %s %s"
+                         (slime-connection-name conn)
+                         (process-contact conn)))
+            (slime-connect "localhost" port))))))
 
-(dolist (num (number-sequence 1 5))
-  (define-key (current-global-map)
-    (read-kbd-macro (concat "C-c " (number-to-string num)))
-    (make-slime-connector (+ 4004 num))))
+  (dolist (num (number-sequence 1 5))
+    (define-key (current-global-map)
+      (read-kbd-macro (concat "C-c " (number-to-string num)))
+      (make-slime-connector (+ 4004 num)))))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.