Next: Abstract Display Example, Up: Abstract Display
In this subsection, ewoc and node stand for the structures described above (see Abstract Display), while data stands for an arbitrary Lisp object used as a data element.
This constructs and returns a new ewoc, with no nodes (and thus no data elements). pretty-printer should be a function that takes one argument, a data element of the sort you plan to use in this ewoc, and inserts its textual description at point using
insert
(and neverinsert-before-markers
, because that would interfere with the Ewoc package's internal mechanisms).Normally, a newline is automatically inserted after the header, the footer and every node's textual description. If nosep is non-
nil
, no newline is inserted. This may be useful for displaying an entire ewoc on a single line, for example, or for making nodes invisible by arranging for pretty-printer to do nothing for those nodes.An ewoc maintains its text in the buffer that is current when you create it, so switch to the intended buffer before calling
ewoc-create
.
This returns a cons cell
(
header.
footer)
made from ewoc's header and footer.
This sets the header and footer of ewoc to the strings header and footer, respectively.
These add a new node encapsulating data, putting it, respectively, at the beginning or end of ewoc's chain of nodes.
These add a new node encapsulating data, adding it to ewoc before or after node, respectively.
These return, respectively, the previous node and the next node of node in ewoc.
This returns the node in ewoc found at zero-based index n. A negative n means count from the end.
ewoc-nth
returnsnil
if n is out of range.
This determines the node in ewoc which contains point (or pos if specified), and returns that node. If ewoc has no nodes, it returns
nil
. If pos is before the first node, it returns the first node; if pos is after the last node, it returns the last node. The optional third arg guess should be a node that is likely to be near pos; this doesn't alter the result, but makes the function run faster.
These move point to the previous or next, respectively, argth node in ewoc.
ewoc-goto-prev
does not move if it is already at the first node or if ewoc is empty, whereasewoc-goto-next
moves past the last node, returningnil
. Excepting this special case, these functions return the node moved to.
This function regenerates the text of ewoc. It works by deleting the text between the header and the footer, i.e., all the data elements' representations, and then calling the pretty-printer function for each node, one by one, in order.
This is similar to
ewoc-refresh
, except that only nodes in ewoc are updated instead of the entire set.
This calls predicate for each data element in ewoc and deletes those nodes for which predicate returns
nil
. Any args are passed to predicate.