[slime-cvs] CVS slime

heller heller at common-lisp.net
Wed Sep 17 06:20:22 UTC 2008


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

Modified Files:
	ChangeLog slime.el 
Log Message:
* slime.el (slime-connection): Optionally select a new default
connection.
(slime-auto-select-connection): New variable.
(slime-auto-select-connection): New function.

--- /project/slime/cvsroot/slime/ChangeLog	2008/09/17 06:19:47	1.1510
+++ /project/slime/cvsroot/slime/ChangeLog	2008/09/17 06:20:05	1.1511
@@ -6,6 +6,13 @@
 
 2008-09-16  Helmut Eller  <heller at common-lisp.net>
 
+	* slime.el (slime-connection): Optionally select a new default
+	connection.
+	(slime-auto-select-connection): New variable.
+	(slime-auto-select-connection): New function.
+
+2008-09-16  Helmut Eller  <heller at common-lisp.net>
+
 	Adjust positions in files with CRLF style end-on-line markers.
 
 	* slime.el (slime-eol-conversion-fixup): New function.
--- /project/slime/cvsroot/slime/slime.el	2008/09/17 06:19:47	1.1018
+++ /project/slime/cvsroot/slime/slime.el	2008/09/17 06:20:09	1.1019
@@ -1816,7 +1816,8 @@
 Signal an error if there's no connection."
   (let ((conn (slime-current-connection)))
     (cond ((and (not conn) slime-net-processes)
-           (error "No default connection selected."))
+           (or (slime-auto-select-connection)
+               (error "No default connection selected.")))
           ((not conn)
            (or (slime-auto-connect)
                (error "Not connected.")))
@@ -1837,6 +1838,21 @@
            (slime-connection)))
         (t nil)))
 
+(defvar slime-auto-select-connection 'ask)
+
+(defun slime-auto-select-connection ()
+  (let* ((c0 (car slime-net-processes))
+         (c (cond ((eq slime-auto-select-connection 'always) c0)
+                  ((and (eq slime-auto-select-connection 'ask)
+                        (y-or-n-p 
+                         (format "No default connection selected.  %s %s? "
+                                 "Switch to" (slime-connection-name c0))))
+                   c0))))
+    (when c
+      (slime-select-connection c)
+      (message "Switching to connection: %s" (slime-connection-name c))
+      c)))
+
 (defun slime-select-connection (process)
   "Make PROCESS the default connection."
   (setq slime-default-connection process))
@@ -4661,16 +4677,15 @@
   ;; Return the number of \r\n eol markers that we need to cross when
   ;; moving N chars forward.  N is the number of chars but \r\n are
   ;; counted as 2 separate chars.
-  (let* ((eol-type (coding-system-eol-type buffer-file-coding-system)))
-    (ecase eol-type
-      ((0 2) 0)
-      ((1) 
-       (save-excursion 
-         (do ((pos (+ (point) n))
-              (count 0 (1+ count)))
-             ((>= (point) pos) (1- count))
-           (forward-line)
-           (decf pos)))))))
+  (case (coding-system-eol-type buffer-file-coding-system)
+    ((0 2) 0)
+    ((1) 
+     (save-excursion 
+       (do ((pos (+ (point) n))
+            (count 0 (1+ count)))
+           ((>= (point) pos) (1- count))
+         (forward-line)
+         (decf pos))))))
 
 (defun slime-search-method-location (name specializers qualifiers)
   ;; Look for a sequence of words (def<something> method name




More information about the slime-cvs mailing list