Commit d5c49066 authored by João Távora's avatar João Távora
Browse files

Debugger's "copy down to repl" more useful

Still a little broken when called from an error that just happened in
the REPL itself.

* contrib/sly-mrepl.el (sly-mrepl--eval-for-repl): Accept new argument
`out-of-band' to eval in channel but in caller's thread.
(sldb-copy-down-to-repl): Pass `out-of-band' to
`sly-mrepl--eval-for-repl'.

* contrib/swank-mrepl.lisp (:compile-toplevel): Import FIND-CHANNEL.
(eval-in-mrepl): New function.
parent 72a3568b
Showing with 21 additions and 9 deletions
+21 -9
......@@ -265,14 +265,20 @@ If message can't be sent right now, queue it onto
;;; copy-down-to-REPL behaviour
;;;
(defun sly-mrepl--eval-for-repl (form)
(with-current-buffer (sly-mrepl)
(let ((comint-input-sender
#'(lambda (_proc _string)
(sly-mrepl--send-string
(format "%s" form)))))
(comint-send-input)
(pop-to-buffer (current-buffer)))))
(defun sly-mrepl--eval-for-repl (form &optional out-of-band)
(let ((original-thread sly-current-thread))
(with-current-buffer (sly-mrepl)
(let ((comint-input-sender
#'(lambda (_proc _string)
(let ((string (format "%s" form)))
(if out-of-band
(let ((sly-current-thread original-thread))
(sly-eval `(swank-mrepl:eval-in-mrepl
,sly-mrepl--remote-channel
,string)))
(sly-mrepl--send-string string))))))
(comint-send-input)
(pop-to-buffer (current-buffer))))))
(defun sly-inspector-copy-down-to-repl (number)
"Evaluate the inspector slot at point via the REPL (to set `*')."
......@@ -283,7 +289,8 @@ If message can't be sent right now, queue it onto
(defun sldb-copy-down-to-repl (frame-id var-id)
"Evaluate the frame var at point via the REPL (to set `*')."
(interactive (list (sldb-frame-number-at-point) (sldb-var-number-at-point)))
(sly-mrepl--eval-for-repl `(swank-backend:frame-var-value ,frame-id ,var-id)))
(sly-mrepl--eval-for-repl `(swank-backend:frame-var-value ,frame-id ,var-id)
'out-of-band))
(defun sly-trace-dialog-copy-down-to-repl (id part-id type)
"Eval the Trace Dialog entry under point in the REPL (to set *)"
......
......@@ -13,6 +13,7 @@
define-channel-method
defslyfun
destructure-case
find-channel
log-event
process-requests
send-to-remote-channel
......@@ -80,6 +81,10 @@
(package-name pkg)
(package-prompt pkg))))
(defslyfun eval-in-mrepl (remote string)
"Like MREPL-EVAL, but not run in channel's thread."
(mrepl-eval (find-channel remote) string))
(defvar *history* nil)
(defun initial-listener-env (channel)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment