[slime-cvs] CVS slime

CVS User trittweiler trittweiler at common-lisp.net
Fri Oct 23 19:40:14 UTC 2009


Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv10376

Modified Files:
	slime.el ChangeLog 
Log Message:
	Restarts in SLDB are now numbered reversely. The rationale is that
	always-existing restarts are likely to be associated with the same
	number now.

	* slime.el (sldb-insert-restarts): Number restart reversely.
	(sldb-restart-number-for-swank): New; recompute the unreversed
	number for the swank side.
	(sldb-restart-number-at-point): Previously `sldb-restart-at-point'.
	(sldb-invoke-restart): Adapted accordingly.


--- /project/slime/cvsroot/slime/slime.el	2009/10/23 09:34:56	1.1231
+++ /project/slime/cvsroot/slime/slime.el	2009/10/23 19:40:14	1.1232
@@ -5485,7 +5485,7 @@
     (eval `(defun ,fname ()
              ,docstring
              (interactive)
-             (sldb-invoke-restart ,number)))
+             (sldb-invoke-restart (sldb-restart-number-for-swank ,number))))
     (define-key sldb-mode-map (number-to-string number) fname)))
 
 
@@ -5630,17 +5630,20 @@
 RESTARTS should be a list ((NAME DESCRIPTION) ...)."
   (let* ((len (length restarts))
          (end (if count (min (+ start count) len) len)))
+    ;; N.B. We deliberately number the restarts reversely so always
+    ;; existing restarts (e.g. SWANK's RETRY restart) will likely get
+    ;; the same numeric value.
     (loop for (name string) in (subseq restarts start end)
-          for number from start do
-          (unless (bolp) (insert "\n"))
-          (slime-insert-propertized
-           `(, at nil restart-number ,number
-                   sldb-default-action sldb-invoke-restart
-                   mouse-face highlight)
-           " " (in-sldb-face restart-number (number-to-string number))
-           ": ["  (in-sldb-face restart-type name) "] "
-           (in-sldb-face restart string))
-          (insert "\n"))
+          for number from (1- len) downto start
+          do (unless (bolp) (insert "\n"))
+             (slime-insert-propertized
+               `(, at nil sldb-restart-number ,number
+                       sldb-default-action sldb-invoke-restart
+                       mouse-face highlight)
+               " " (in-sldb-face restart-number (number-to-string number))
+               ": ["  (in-sldb-face restart-type name) "] "
+               (in-sldb-face restart string))
+             (insert "\n"))
     (when (< end len)
       (let ((pos (point)))
         (slime-insert-propertized
@@ -5654,6 +5657,10 @@
     (delete-region position (1+ (line-end-position)))
     (sldb-insert-restarts restarts start nil)))
 
+;;; Fix up the reverse ordering. Cf. `sldb-insert-restarts'.
+(defun sldb-restart-number-for-swank (restart-number)
+  (- (length sldb-restarts) (1+ restart-number)))
+
 (defun sldb-frame.string (frame)
   (destructuring-bind (_ str &optional _) frame str))
 
@@ -5732,9 +5739,11 @@
 
 ;;;;;; SLDB examining text props
 
-(defun sldb-restart-at-point ()
-  (or (get-text-property (point) 'restart-number)
-      (error "No restart at point")))
+(defun sldb-restart-number-at-point ()
+  (let ((n (get-text-property (point) 'sldb-restart-number)))
+    (unless n
+      (error "No restart at point"))
+    (sldb-restart-number-for-swank n)))
 
 (defun sldb-frame-number-at-point ()
   (let ((frame (get-text-property (point) 'frame)))
@@ -6129,10 +6138,10 @@
 
 (defun sldb-invoke-restart (&optional number)
   "Invoke a restart.
-Optional NUMBER specifies the restart to invoke, otherwise
-use the restart at point."
+Optional NUMBER (index into `sldb-restarts') specifies the
+restart to invoke, otherwise use the restart at point."
   (interactive)
-  (let ((restart (or number (sldb-restart-at-point))))
+  (let ((restart (or number (sldb-restart-number-at-point))))
     (slime-rex ()
         ((list 'swank:invoke-nth-restart-for-emacs sldb-level restart))
       ((:ok value) (message "Restart returned: %s" value))
--- /project/slime/cvsroot/slime/ChangeLog	2009/10/23 09:34:56	1.1881
+++ /project/slime/cvsroot/slime/ChangeLog	2009/10/23 19:40:14	1.1882
@@ -1,5 +1,17 @@
 2009-10-23  Tobias C. Rittweiler <tcr at freebits.de>
 
+	Restarts in SLDB are now numbered reversely. The rationale is that
+	always-existing restarts are likely to be associated with the same
+	number now.
+
+	* slime.el (sldb-insert-restarts): Number restart reversely.
+	(sldb-restart-number-for-swank): New; recompute the unreversed
+	number for the swank side.
+	(sldb-restart-number-at-point): Previously `sldb-restart-at-point'.
+	(sldb-invoke-restart): Adapted accordingly.
+
+2009-10-23  Tobias C. Rittweiler <tcr at freebits.de>
+
 	When ever Slime seems to get stuck (e.g. after some character
 	encoding confusion), `M-x slime-reset' should hopefully bring it
 	into a functional state again.





More information about the slime-cvs mailing list