[slime-cvs] CVS slime/contrib

CVS User sboukarev sboukarev at common-lisp.net
Fri Dec 23 20:03:15 UTC 2011


Update of /project/slime/cvsroot/slime/contrib
In directory tiger.common-lisp.net:/tmp/cvs-serv11440/contrib

Modified Files:
	ChangeLog slime-repl.el 
Log Message:
* slime.el (slime-cycle-connections): Add
`slime-cycle-connections-hook', to be used by slime-repl.

* contrib/slime-repl.el (slime-change-repl-to-default-connection): New
function.
Changes the current REPL to the REPL of the default connection. If
the current buffer is not a REPL, don't do anything.
Put it into `slime-cycle-connections-hook', so that when
connections are cycled through it will change the currently
displayed REPL.


--- /project/slime/cvsroot/slime/contrib/ChangeLog	2011/12/10 12:33:57	1.526
+++ /project/slime/cvsroot/slime/contrib/ChangeLog	2011/12/23 20:03:15	1.527
@@ -1,3 +1,13 @@
+2011-12-23  Stas Boukarev  <stassats at gmail.com>
+
+	* slime-repl.el (slime-change-repl-to-default-connection): New
+	function.
+	Changes the current REPL to the REPL of the default connection. If
+	the current buffer is not a REPL, don't do anything.
+	Put it into `slime-cycle-connections-hook', so that when
+	connections are cycled through it will change the currently
+	displayed REPL.
+
 2011-12-10  Helmut Eller  <heller at common-lisp.net>
 
 	Don't call init-global-stream-redirection in *after-init-hook*.
--- /project/slime/cvsroot/slime/contrib/slime-repl.el	2011/12/04 15:18:42	1.62
+++ /project/slime/cvsroot/slime/contrib/slime-repl.el	2011/12/23 20:03:15	1.63
@@ -27,8 +27,7 @@
   (:authors "too many to mention")
   (:license "GPL")
   (:on-load
-   (add-hook 'slime-event-hooks 'slime-repl-event-hook-function)
-   (add-hook 'slime-connected-hook 'slime-repl-connected-hook-function)
+   (slime-repl-add-hooks) 
    (setq slime-find-buffer-package-function 'slime-repl-find-buffer-package))
   (:on-unload (slime-repl-remove-hooks))
   (:swank-dependencies swank-repl))
@@ -1704,13 +1703,26 @@
      t)
     (t nil)))
 
+(defun slime-change-repl-to-default-connection ()
+  "Change current REPL to the REPL of the default connection.
+If the current buffer is not a REPL, don't do anything."
+  (when (equal major-mode 'slime-repl-mode)
+    (let ((slime-buffer-connection slime-default-connection))
+      (pop-to-buffer-same-window (slime-connection-output-buffer)))))
+
 (defun slime-repl-find-buffer-package ()
   (or (slime-search-buffer-package)
       (slime-lisp-package)))
 
+(defun slime-repl-add-hooks ()
+  (add-hook 'slime-event-hooks 'slime-repl-event-hook-function)
+  (add-hook 'slime-connected-hook 'slime-repl-connected-hook-function)
+  (add-hook 'slime-cycle-connections-hook 'slime-change-repl-to-default-connection))
+
 (defun slime-repl-remove-hooks ()
   (remove-hook 'slime-event-hooks 'slime-repl-event-hook-function)
-  (remove-hook 'slime-connected-hook 'slime-repl-connected-hook-function))
+  (remove-hook 'slime-connected-hook 'slime-repl-connected-hook-function)
+  (remove-hook 'slime-cycle-connections-hook 'slime-change-repl-to-default-connection))
 
 (let ((byte-compile-warnings '()))
   (mapc #'byte-compile





More information about the slime-cvs mailing list