Customizes the information displayed and sort order of attributes/values in the LispWorks IDE Inspector tool.
The object to be inspected.
Name of a mode, or nil
. nil
defines the default inspection format for object.
The two lists displayed in columns in the Inspector window.
Ignored.
A function used to update slot values.
Displayed in the Inspector window.
A boolean.
The generic functions get-inspector-values
and sort-inspector-p
allow you to customize the LispWorks IDE Inspector tool by adding new ways to display class instances and control sorting of the attributes and values.
get-inspector-values
allows you to add new formats (corresponding to different values of mode) in which instances of a particular class can be inspected. Mode nil
is the default mode, which is always present (it can be overwritten).
LispWorks includes methods for:
(get-inspector-values (object nil))
(get-inspector-values (standard-object nil))
(get-inspector-values (structured-object nil))
(get-inspector-values (sequence nil))
(get-inspector-values cons nil))
sort-inspector-p
determines whether to sort the list of displayed attributes/values.
The Inspector tool calls sort-inspector-p
with the current object and mode the first time it displays this object in this mode to determine whether to sort the list of attributes/values. If it returns non-nil, it sorts by item, otherwise it does not sort.
There are various methods on system-defined types to get the most useful behavior. You can add methods for your own types.
The sort type can be changed interactively in the Inspector tool by using the the Preferences... dialog.
This example allows inspection of a CLOS object, displaying only direct slots form a chosen class in its class precedence list. This can be useful when an object inherits many slots from superclasses, and the inherited slots are of no interest.
(defmethod lispworks:get-inspector-values
((object standard-object)
(mode (eql 'direct-as)))
(declare (ignore mode))
(loop with object-class =
(class-of object)
with precedence-list =
(class-precedence-list object-class)
with items =
(loop for super in precedence-list
collecting (list*
(format nil "~a"
(class-name super))
super))
with class =
(or (capi:prompt-with-list items
"Direct slots as ...")
object-class)
;; default if no selection
with slots =
(class-direct-slots class)
for slot in slots
for name =
(clos::slot-definition-name slot)
collect name into names
collect (if (slot-boundp object name)
(slot-value object name)
:slot-unbound)
into values
finally
(return
(values
names
values
nil
#'(lambda
(x slot-name index new-value)
(declare (ignore index))
(setf (slot-value x slot-name)
new-value))
(format nil "~a - direct slots as ~a"
(class-name object-class)
(class-name class))))))
LispWorks User Guide and Reference Manual - 20 Sep 2017