10 Customizing Objects

EIEIO supports the Custom facility through two new widget types. If a variable is declared as type object, then full editing of slots via the widgets is made possible. This should be used carefully, however, because modified objects are cloned, so if there are other references to these objects, they will no longer be linked together.

If you want in place editing of objects, use the following methods:

Function: eieio-customize-object object

Create a custom buffer and insert a widget for editing object. At the end, an Apply and Reset button are available. This will edit the object "in place" so references to it are also changed. There is no effort to prevent multiple edits of a singular object, so care must be taken by the user of this function.

Function: eieio-custom-widget-insert object flags

This method inserts an edit object into the current buffer in place. It is implemented as (widget-create 'object-edit :value object). This method is provided as a locale for adding tracking, or specializing the widget insert procedure for any object.

To define a slot with an object in it, use the object tag. This widget type will be automatically converted to object-edit if you do in place editing of you object.

If you want to have additional actions taken when a user clicks on the Apply button, then overload the method eieio-done-customizing. This method does nothing by default, but that may change in the future. This would be the best way to make your objects persistent when using in-place editing.

10.1 Widget extension

When widgets are being created, one new widget extension has been added, called the :slotofchoices. When this occurs in a widget definition, all elements after it are removed, and the slot is specifies is queried and converted into a series of constants.

(choice (const :tag "None" nil)
        :slotofchoices morestuff)

and if the slot morestuff contains (sym1 sym2 sym3), the above example is converted into:

(choice (const :tag "None" nil)
        (const sym1)
        (const sym2)
        (const sym3))

This is useful when a given item needs to be selected from a list of items defined in this second slot.