Chisheng Huang cph@chi-square-works.com writes:
(defun send-to-emacs (object) "Send OBJECT to Emacs." (when *emacs-connection* (funcall (connection.send *emacs-connection*) object)))
If you think this fix is O.K., would you please merge it into swank.lisp?
That's not the best place for the test because *emacs-connection* _should_ never be nil here. Adding the test here makes finding bugs harder, as it would be a kind of fail silent behavior.
I added the test in the gc-hooks instead. There's also new variable *install-gc-hooks* to disable the gc hooks for SLIME entirely.
Of course, it's entirely logical to ask why *EMACS-CONNECTION* is NIL in the first place, which is totally beyond me.
Yes, that's a good question. It can be nil if a you disconnect and a GC happens afterwards or if you do some asynchronous processing, e.g., in a fd-handler or a thread. It should never be nil if the GC is (indirectly) triggered by a SLIME request.
Helmut.