[slime-devel] SLIME 2007-03-24 change to remove the timer for async REPL output

Matthias Koeppe mkoeppe+slime at mail.math.uni-magdeburg.de
Sun Aug 26 00:13:14 UTC 2007


Helmut,

the change below (from 2007-03-24) causes the output and the REPL
result to be displayed in the wrong order (occasionally,
non-deterministically), when *use-dedicated-output-stream* = t.  (This
was reported on the mailing list on 2007-04-22 and I can reproduce it;
however, I am normally not using this mode myself.)

The reason is a race between the REPL results (sent through SLIME
events) and the regular process output (sent through the dedicated
stream).  The removed code worked around this race by waiting a small
amount of time.

2007-03-24  Helmut Eller  <heller at common-lisp.net>

	* slime.el (slime-repl-insert-prompt): Use insert-before-markers. This fixes
	some redisplay problems, but I don't know why.  Also: remove the
	timer for async output.
	(slime-repl-move-output-mark-before-prompt): Removed.

I would like to re-introduce (and document the rationale of) the
removed code using the patch below, for the benefit of users of
*use-dedicated-output-stream* = t.

Any objections?

Matthias

--- slime.el	25 Aug 2007 13:02:47 -0700	1.815
+++ slime.el	25 Aug 2007 16:53:15 -0700	
@@ -3710,11 +3716,30 @@
       (insert-before-markers prompt))
     (set-marker slime-repl-prompt-start-mark prompt-start)
     (goto-char slime-repl-prompt-start-mark)
-    (slime-mark-output-start)
+    ;;(slime-mark-output-start)
+    ;;; We wish to distinguish between the output of a command
+    ;;; and asynchronous output (caused by another thread) that happens to be sent.
+    ;;; The command output should appear before the REPL result;
+    ;;; the asynchronous output should appear after it.
+    ;;;
+    ;;; However, when a dedicated output stream is used, there is a
+    ;;; race between the REPL results (which appear as a SLIME event)
+    ;;; and the regular output (which appears on the dedicated
+    ;;; stream).  As a workaround, after a small amount of time,
+    ;;; decide that all following output is asynchronous output.
+    (run-at-time 0.2 nil 'slime-repl-move-output-mark-before-prompt
+                 (current-buffer))
     (goto-char (point-max))
     (slime-mark-input-start))
   (slime-repl-show-maximum-output))
 
+(defun slime-repl-move-output-mark-before-prompt (buffer)
+  (when (buffer-live-p buffer)
+    (with-current-buffer buffer
+      (save-excursion 
+        (goto-char slime-repl-prompt-start-mark)
+        (slime-mark-output-start)))))
+
 (defun slime-repl-show-maximum-output (&optional force)
   "Put the end of the buffer at the bottom of the window."
   (assert (eobp))

-- 
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe
(currently @math.ucdavis.edu)




More information about the slime-devel mailing list