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))
Matthias Koeppe mkoeppe+slime@merkur.math.uni-magdeburg.de writes:
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.
I installed the patch. It would be nice if the function were a bit shorter but I know it's hard to factorize those backward/forward pairs.
Helmut.
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
I installed the patch.
Thanks, Helmut. I am sending below another patch that improves the inspector.
Matthias
2005-01-11 Matthias Koeppe mkoeppe@mail.math.uni-magdeburg.de
* slime.el (slime-inspector-operate-on-click): New command for inspecting the value value at the clicked-at position or invoking an inspector action. (slime-inspector-mode-map): Bind it to mouse-2. (slime-inspector-insert-ispec): Add mouse-face properties for clickable values and action buttons.
Index: slime.el =================================================================== RCS file: /project/slime/cvsroot/slime/slime.el,v retrieving revision 1.444 diff -u -p -r1.444 slime.el --- slime.el 10 Jan 2005 19:32:00 -0000 1.444 +++ slime.el 11 Jan 2005 20:17:44 -0000 @@ -6826,10 +6836,12 @@ Optionally set point to POINT." (destructure-case ispec ((:value string id) (slime-insert-propertized (list 'slime-part-number id + 'mouse-face 'highlight 'face 'slime-inspector-value-face) string)) ((:action string id) (slime-insert-propertized (list 'slime-action-number id + 'mouse-face 'highlight 'face 'slime-inspector-action-face) string)))))
@@ -6849,6 +6861,19 @@ Optionally set point to POINT." (lambda (parts) (slime-open-inspector parts point))))))))
+(defun slime-inspector-operate-on-click (event) + "Inspect the value at the clicked-at position or invoke an action." + (interactive "@e") + (let ((point (posn-point (event-end event)))) + (cond + ((and point + (or (get-text-property point 'slime-part-number) + (get-text-property point 'slime-action-number))) + (goto-char point) + (slime-inspector-operate-on-point)) + (t + (error "No clickable part here"))))) + (defun slime-inspector-copy-down (number) "Evaluate the slot at point via the REPL (to set `*')." (interactive (list (or (get-text-property (point) 'slime-part-number) @@ -6945,6 +6970,7 @@ If ARG is negative, move forwards." ([return] 'slime-inspector-operate-on-point) ([(meta return)] 'slime-inspector-copy-down) ("\C-m" 'slime-inspector-operate-on-point) + ([mouse-2] 'slime-inspector-operate-on-click) ("l" 'slime-inspector-pop) ("n" 'slime-inspector-next) (" " 'slime-inspector-next)