jsk-ros-pkg / euslime

Emacs SLIME for Euslisp
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

do-until-key doesn't work #4

Closed Affonso-Gui closed 2 years ago

Affonso-Gui commented 3 years ago

do-until-key and other functions that use select-stream don't work as expected.

(defmacro do-until-key-with-check
  (check &rest forms)
  `(prog1
       (while (and (null (select-stream (list *standard-input*) 0.0000001))
                   (eval ,check))
         ,@forms
         )
     (let ((strm (car (select-stream (list *standard-input*) 0.1)))) (if strm (read-line strm nil nil)))
     ))

This is happening because since there is no active read call to the stream the slime read-mode is not activated, causing input to be classified as a new repl request which is put on standby until the first evaluation is done.

slime-events

(:emacs-rex
 (swank-repl:listener-eval "(do-until-key (print 1) (unix:sleep 1))\n")
 "USER" :repl-thread 61)
(:write-string "1\n")
(:write-string "1\n")
(:write-string "1\n")
(:emacs-rex
 (swank-repl:listener-eval "end\n")
 "USER" :repl-thread 62)
(:write-string "1\n")
(:write-string "1\n")

inferior-lisp

[DEBUG - server:L80] raw header: 000046
[DEBUG - server:L87] raw data: (:emacs-rex (swank-repl:listener-eval "end
") "USER" :repl-thread 62)

[DEBUG - protocol:L69] Processing id: 62 ...
[INFO - protocol:L71] func: swank_repl_listener_eval
[INFO - protocol:L72] args: [u'end\n']
[DEBUG - handler:L216] Acquiring lock: <thread.lock object at 0x7fb27b0df590>
[DEBUG - server:L45] output: 1

[DEBUG - server:L45] output: 1
Affonso-Gui commented 2 years ago

Fixed in https://github.com/Affonso-Gui/euslime/commit/d246ce658c630ef20b801e2397e22832d38a53d5