Helmut Eller e9626484@stud3.tuwien.ac.at writes:
I tried to remove the state machine some time ago, but wasn't very successful. The id argument in eval-string stems from that attempt.
I wondered why you put it there! Today I have been working on removing the state machine too, and the `id' is really helpful :-)
Here some problems I encountered:
The current state stack contains (state-name . variables) pairs. It wasn't obvious to me where I should store the variables instead. Including the variables in the request itself doesn't work, because the variables contain things like window configurations. Storing them in a buffer -- e.g., the variables of the debugging state in the sldb buffer -- doesn't work because the user can delete the buffer. So I stored them on a stack again :-)
I've tried putting the sldb window configuration in the *sldb* buffer. It gets set when the SLDB buffer is created and restored when sldb-level 1 exists. If the user kills the buffer, well, he can restore his own stinkin' window configuration ;-)
Another problem was that there where no 'activate' events anymore. When you exited from the debugger at level 3 to level 2, Emacs didn't notice it.
Now that you mention it, I have this problem. :-)
I'll play around a bit more and see what it comes to. Currently I have minimal support for evaluating/debugging/read-string replacing the whole FSM business with about half a page of code:
(defun slime-dispatch-event (event &optional process) (let ((slime-dispatching-connection (or process (slime-connection)))) (slime-log-event event) (unless (slime-handle-oob event) (destructure-case event ((:emacs-rex form-string package continuation) (let ((id (incf slime-continuation-counter))) (push (cons id continuation) slime-rex-continuations) ;; (slime-send `(:rex ,form-string ,package))) (slime-send `(swank:eval-string ,form-string ,package ,id)))) ((:return value id) (when-let (rec (find id slime-rex-continuations :key #'car)) (setq slime-rex-continuations (remove rec slime-rex-continuations)) (let ((continuation (cdr rec))) (funcall continuation value)))) ((:read-string tag) (setq slime-read-string-tag tag)) ((:read-aborted) (setq slime-read-string-tag nil)) ((:emacs-return-string string) (slime-send `(swank:take-input ,slime-read-string-tag ,string)) (setq slime-read-string-tag nil)) ((:debug level condition restarts frames) (sldb-setup level condition restarts frames)) ((:debug-return level) (sldb-exit level))))))
That feels good. If it can be made to work then it also means the code for auxiliary connections in both Emacs and Lisp can be deleted too.
Oh I hope it can be made to work well... :-)
Cheers, Luke