[slime-cvs] CVS slime

heller heller at common-lisp.net
Tue Sep 4 09:55:32 UTC 2007


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

Modified Files:
	ChangeLog slime.el 
Log Message:
Simplify slime-process-available-input.

* slime.el (slime-process-available-input): We are called in a
process filter, i.e. at arbitrary times and in an aribtrary
buffer.  So it doesn't make sense to save-and-restore the current
buffer here
(slime-eval-async): Instead, save and restore the buffer here.
(slime-net-read-or-lose): New.



--- /project/slime/cvsroot/slime/ChangeLog	2007/09/04 09:49:09	1.1194
+++ /project/slime/cvsroot/slime/ChangeLog	2007/09/04 09:55:32	1.1195
@@ -1,5 +1,16 @@
 2007-09-04  Helmut Eller  <heller at common-lisp.net>
 
+	Simplify slime-process-available-input.
+
+	* slime.el (slime-process-available-input): We are called in a
+	process filter, i.e. at arbitrary times and in an aribtrary
+	buffer.  So it doesn't make sense to save-and-restore the current
+	buffer here
+	(slime-eval-async): Instead, save and restore the buffer here.
+	(slime-net-read-or-lose): New.
+
+2007-09-04  Helmut Eller  <heller at common-lisp.net>
+
 	Remove request-abort condition.
 
 	* swank-backend.lisp (request-abort): Removed
--- /project/slime/cvsroot/slime/slime.el	2007/09/04 09:49:09	1.843
+++ /project/slime/cvsroot/slime/slime.el	2007/09/04 09:55:32	1.844
@@ -1974,26 +1974,17 @@
 
 (defun slime-process-available-input (process)
   "Process all complete messages that have arrived from Lisp."
-  (let ((original-buffer (current-buffer)))
-    (with-current-buffer (process-buffer process)
-      (while (slime-net-have-input-p)
-        (let ((event (condition-case error
-                         (slime-net-read)
-                       (error
-                        (slime-net-close process t)
-                        (error "net-read error: %S" error)))))
-          (slime-log-event event)
-          (let ((ok nil))
-            (unwind-protect
-                 (with-current-buffer 
-                     (if (buffer-live-p original-buffer)
-                         original-buffer
-                         (current-buffer))
-                   (slime-dispatch-event event process)
-                   (setq ok t))
-              (unless ok 
-                (slime-run-when-idle 
-                 'slime-process-available-input process)))))))))
+  (with-current-buffer (process-buffer process)
+    (while (slime-net-have-input-p)
+      (let ((event (slime-net-read-or-lose process))
+            (ok nil))
+        (slime-log-event event)
+        (unwind-protect
+            (save-current-buffer
+              (slime-dispatch-event event process)
+              (setq ok t))
+          (unless ok
+            (slime-run-when-idle 'slime-process-available-input process)))))))
 
 (defun slime-net-have-input-p ()
   "Return true if a complete message is available."
@@ -2001,6 +1992,14 @@
   (and (>= (buffer-size) 6)
        (>= (- (buffer-size) 6) (slime-net-decode-length))))
 
+(defun slime-net-read-or-lose (process)
+  (condition-case error
+      (slime-net-read)
+    (error
+     (debug)
+     (slime-net-close process t)
+     (error "net-read error: %S" error))))
+
 (defun slime-net-read ()
   "Read a message from the network buffer."
   (goto-char (point-min))
@@ -2539,10 +2538,12 @@
 
 (defun slime-eval-async (sexp &optional cont package)
   "Evaluate EXPR on the superior Lisp and call CONT with the result."
-  (slime-rex (cont)
+  (slime-rex (cont (buffer (current-buffer)))
       (sexp (or package (slime-current-package)))
     ((:ok result)
-     (when cont (funcall cont result)))
+     (when cont
+       (set-buffer buffer)
+       (funcall cont result)))
     ((:abort)
      (message "Evaluation aborted."))))
 




More information about the slime-cvs mailing list