Skip to content

Interface Functions ​

If you need to write a mode based on vtable, you will have to interact with the table in various ways—for instance, you’ll need to write commands that updates an object and then displays the result. This chapter describes functions for such interaction.

Function: vtable-current-table ​

This function returns the table under point.

Function: vtable-current-object ​

This function returns the object on the current line. (Note that this is the original object, not the characters displayed in the buffer.)

Function: vtable-current-column ​

This function returns the column index of the column under point.

Function: vtable-goto-table table ​

Move point to the start of table and return the position. If table can’t be found in the current buffer, don’t move point and return nil.

Function: vtable-goto-object object ​

Move point to the start of the line where object is displayed in the current table and return the position. If object can’t be found, don’t move point and return nil.

Function: vtable-goto-column index ​

Move point to the start of the indexth column. (The first column is numbered zero.)

Function: vtable-beginning-of-table ​

Move to the beginning of the current table.

Function: vtable-end-of-table ​

Move to the end of the current table.

Function: vtable-remove-object table object ​

Remove object from table. This also updates the displayed table.

Function: vtable-insert-object table object &optional location before ​

Insert object into table. location should be an object in the table, the new object is inserted after this object, or before it if before is non-nil. If location is nil, object is appended to table, or prepended if before is non-nil.

location can also be an integer, a zero-based index into the table. In this case, object is inserted at that index. If the index is out of range, object is prepended to table if the index is too small, or appended if it is too large. In this case, before is ignored.

If table is empty, location and before are ignored.

This also updates the displayed table.

Function: vtable-update-object table object &optional old-object ​

Update object’s representation in table. Optional argument old-object, if non-nil, means to replace old-object with object and redisplay the associated row in the table. In either case, if the existing object is not found in the table (being compared with equal), signal an error.

This has the same effect as calling vtable-remove-object and then vtable-insert-object, but is more efficient.

Note a limitation: if the table’s buffer is not in a visible window, or if its window has changed width since it was updated, updating the table is not possible, and an error is signaled.

Function: vtable-column table index ​

Return the column name of the indexth column in table.