[slime-cvs] CVS slime
trittweiler
trittweiler at common-lisp.net
Tue Sep 9 12:35:46 UTC 2008
Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv17985
Modified Files:
swank.lisp ChangeLog
Log Message:
A RETRY restart is provided for all Slime evaluation requests.
The rationale is that restarting from a frame is mostly only
possible for functions compiled with high debug settings; most
functions aren't, however.
[Alternatively, we could make EVAL-FOR-EMACS be compiled with a
high debug level, so it'll become restartable. That would be
non-obvious to the user, though, and would only work on those
implementations that implement SWANK-BACKEND:RESTART-FRAME.]
* swank.lisp (call-with-retry-restart): New function.
(with-retry-restart): New macro.
(eval-for-emacs): Use WITH-RETRY-RESTART.
--- /project/slime/cvsroot/slime/swank.lisp 2008/09/08 22:35:58 1.582
+++ /project/slime/cvsroot/slime/swank.lisp 2008/09/09 12:35:46 1.583
@@ -1795,6 +1795,22 @@
;;;; Evaluation
+(defun call-with-retry-restart (msg thunk)
+ (let ((%ok (gensym "OK+"))
+ (%retry (gensym "RETRY+")))
+ (restart-bind
+ ((retry
+ (lambda () (throw %retry nil))
+ :report-function
+ (lambda (stream)
+ (write msg :stream stream))))
+ (catch %ok
+ (loop (catch %retry (throw %ok (funcall thunk))))))))
+
+(defmacro with-retry-restart ((&key (msg "Retry.")) &body body)
+ (check-type msg string)
+ `(call-with-retry-restart ,msg #'(lambda () , at body)))
+
(defvar *pending-continuations* '()
"List of continuations for Emacs. (thread local)")
@@ -1815,9 +1831,11 @@
(*pending-continuations* (cons id *pending-continuations*)))
(check-type *buffer-package* package)
(check-type *buffer-readtable* readtable)
- ;; APPLY would be cleaner than EVAL.
- ;;(setq result (apply (car form) (cdr form)))
- (setq result (with-slime-interrupts (eval form)))
+ ;; We provide a general RETRY restart because RESTART-FRAME
+ ;; works only on functions compiled with high debug settings,
+ ;; and most aren't.
+ (with-retry-restart (:msg "Retry SLIME evaluation request.")
+ (setq result (with-slime-interrupts (eval form))))
(run-hook *pre-reply-hook*)
(setq ok t))
(send-to-emacs `(:return ,(current-thread)
@@ -2418,7 +2436,7 @@
(defun swank-compiler (function)
(let ((notes-p))
(multiple-value-bind (result usecs)
- (with-simple-restart (abort "Abort SLIME compilation.")
+ (with-simple-restart (abort-compilation "Abort SLIME compilation request.")
(handler-bind ((compiler-condition #'(lambda (c)
(setf notes-p t)
(record-note-for-condition c))))
--- /project/slime/cvsroot/slime/ChangeLog 2008/09/08 22:35:58 1.1492
+++ /project/slime/cvsroot/slime/ChangeLog 2008/09/09 12:35:46 1.1493
@@ -1,5 +1,22 @@
2008-09-09 Tobias C. Rittweiler <tcr at freebits.de>
+ A RETRY restart is provided for all Slime evaluation requests.
+
+ The rationale is that restarting from a frame is mostly only
+ possible for functions compiled with high debug settings; most
+ functions aren't, however.
+
+ [Alternatively, we could make EVAL-FOR-EMACS be compiled with a
+ high debug level, so it'll become restartable. That would be
+ non-obvious to the user, though, and would only work on those
+ implementations that implement SWANK-BACKEND:RESTART-FRAME.]
+
+ * swank.lisp (call-with-retry-restart): New function.
+ (with-retry-restart): New macro.
+ (eval-for-emacs): Use WITH-RETRY-RESTART.
+
+2008-09-09 Tobias C. Rittweiler <tcr at freebits.de>
+
A package "Foo.Bar.1.0" was truncated to "0>" as REPL
prompt. It'll now be displayed as "Bar.1.0>".
More information about the slime-cvs
mailing list