[slime-cvs] CVS slime

mbaringer mbaringer at common-lisp.net
Wed May 23 14:26:15 UTC 2007


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv4602

Modified Files:
	slime.el 
Log Message:
(def-slime-selector-method): Allow the selector body to
not return a buffer. This means that, instead of being to forced
to signal an error when a choosen buffer can't be found (like
choosing d when there are no debugger buffers) can simply display
a message.


--- /project/slime/cvsroot/slime/slime.el	2007/05/17 15:29:02	1.789
+++ /project/slime/cvsroot/slime/slime.el	2007/05/23 14:26:15	1.790
@@ -9692,17 +9692,24 @@
 
 (defmacro def-slime-selector-method (key description &rest body)
   "Define a new `slime-select' buffer selection method.
+
 KEY is the key the user will enter to choose this method.
-DESCRIPTION is a one-line sentence describing how the method selects a
-buffer.
-BODY is a series of forms which must return the buffer to be selected."
+
+DESCRIPTION is a one-line sentence describing how the method
+selects a buffer.
+
+BODY is a series of forms which are evaluated when the selector
+is chosen. If they return a buffer that buffer is selected with
+switch-to-buffer."
   `(setq slime-selector-methods
          (sort* (cons (list ,key ,description
-                            (lambda () (switch-to-buffer (progn , at body))))
+                            (lambda () 
+                              (let ((new-buffer (progn , at body)))
+                                (when (bufferp new-buffer)
+                                  (switch-to-buffer new-buffer)))))
                       (remove* ,key slime-selector-methods :key #'car))
                 #'< :key #'car)))
 
-
 (def-slime-selector-method ?? "Selector help buffer."
   (ignore-errors (kill-buffer "*Select Help*"))
   (with-current-buffer (get-buffer-create "*Select Help*")
@@ -9744,9 +9751,8 @@
 
 (def-slime-selector-method ?d
   "*sldb* buffer for the current connection."
-  (unless (sldb-get-default-buffer)
-    (error "No debugger buffer"))
-  (sldb-get-default-buffer))
+  (or (sldb-get-default-buffer)
+      (message "No debugger buffer")))
 
 (def-slime-selector-method ?e
   "most recently visited emacs-lisp-mode buffer."




More information about the slime-cvs mailing list