The patch below adds a command `slime-inspector-previous-inspectable-object' and binds it to S-TAB in slime-inspector-mode. Moreover, the command `slime-inspector-next-inspectable-object' now accepts a prefix argument. The patch also makes wrapping around more reliable.
I have adapted the code from the Emacs function `widget-move', which is used for similar functionality in Emacs Customize buffers.
Index: slime.el =================================================================== RCS file: /project/slime/cvsroot/slime/slime.el,v retrieving revision 1.443 diff -u -p -u -r1.443 slime.el --- slime.el 16 Dec 2004 22:24:41 -0000 1.443 +++ slime.el 21 Dec 2004 14:55:34 -0000 @@ -6882,18 +6892,58 @@ Optionally set point to POINT." (set-window-configuration slime-saved-window-config) (kill-buffer (current-buffer)))
-(defun slime-inspector-next-inspectable-object () - "sets the point to the next inspectable object" - (interactive) - (let ((pos (if (get-text-property (point) 'slime-part-number) - ;; we're in a part - (next-single-property-change - (or (next-single-property-change (point) 'slime-part-number) (point-min)) - 'slime-part-number) - ;; go to the next part or wrap around - (or (next-single-property-change (point) 'slime-part-number) - (next-single-property-change (point-min) 'slime-part-number))))) - (when pos (goto-char pos)))) +(defun slime-inspector-next-inspectable-object (arg) + "Move point to the next inspectable object. +With optional ARG, move across that many objects. +If ARG is negative, move backwards." + (interactive "p") + (or (bobp) (> arg 0) (backward-char)) + (let ((wrapped 0) + (number arg) + (old (get-text-property (point) 'slime-part-number)) + new) + ;; Forward. + (while (> arg 0) + (cond ((eobp) + (goto-char (point-min)) + (setq wrapped (1+ wrapped))) + (t + (goto-char (or (next-single-property-change (point) 'slime-part-number) + (point-max))))) + (and (= wrapped 2) + (eq arg number) + (error "No inspectable objects")) + (let ((new (get-text-property (point) 'slime-part-number))) + (when new + (unless (eq new old) + (setq arg (1- arg)) + (setq old new))))) + ;; Backward. + (while (< arg 0) + (cond ((bobp) + (goto-char (point-max)) + (setq wrapped (1+ wrapped))) + (t + (goto-char (or (previous-single-property-change (point) 'slime-part-number) + (point-min))))) + (and (= wrapped 2) + (eq arg number) + (error "No inspectable objects")) + (let ((new (get-text-property (point) 'slime-part-number))) + (when new + (unless (eq new old) + (setq arg (1+ arg)))))) + (let ((new (get-text-property (point) 'slime-part-number))) + (while (eq (get-text-property (point) 'slime-part-number) new) + (backward-char))) + (forward-char))) + +(defun slime-inspector-previous-inspectable-object (arg) + "Move point to the previous inspectable object. +With optional ARG, move across that many objects. +If ARG is negative, move forwards." + (interactive "p") + (slime-inspector-next-inspectable-object (- arg)))
(defun slime-inspector-describe () (interactive) @@ -6909,6 +6959,7 @@ Optionally set point to POINT." ("d" 'slime-inspector-describe) ("q" 'slime-inspector-quit) ("\C-i" 'slime-inspector-next-inspectable-object) + ([(shift tab)] 'slime-inspector-previous-inspectable-object) ("\M-." 'slime-edit-definition))