elisp: Abstract Display Functions

 
 37.20.1 Abstract Display Functions
 ----------------------------------
 
 In this subsection, EWOC and NODE stand for the structures described
 above (SeeAbstract Display), while DATA stands for an arbitrary
 Lisp object used as a data element.
 
  -- Function: ewoc-create pretty-printer &optional header footer nosep
      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
      never ‘insert-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’.
 
  -- Function: ewoc-buffer ewoc
      This returns the buffer where EWOC maintains its text.
 
  -- Function: ewoc-get-hf ewoc
      This returns a cons cell ‘(HEADER . FOOTER)’ made from EWOC’s
      header and footer.
 
  -- Function: ewoc-set-hf ewoc header footer
      This sets the header and footer of EWOC to the strings HEADER and
      FOOTER, respectively.
 
  -- Function: ewoc-enter-first ewoc data
  -- Function: ewoc-enter-last ewoc data
      These add a new node encapsulating DATA, putting it, respectively,
      at the beginning or end of EWOC’s chain of nodes.
 
  -- Function: ewoc-enter-before ewoc node data
  -- Function: ewoc-enter-after ewoc node data
      These add a new node encapsulating DATA, adding it to EWOC before
      or after NODE, respectively.
 
  -- Function: ewoc-prev ewoc node
  -- Function: ewoc-next ewoc node
      These return, respectively, the previous node and the next node of
      NODE in EWOC.
 
  -- Function: ewoc-nth ewoc n
      This returns the node in EWOC found at zero-based index N.  A
      negative N means count from the end.  ‘ewoc-nth’ returns ‘nil’ if N
      is out of range.
 
  -- Function: ewoc-data node
      This extracts the data encapsulated by NODE and returns it.
 
  -- Function: ewoc-set-data node data
      This sets the data encapsulated by NODE to DATA.
 
  -- Function: ewoc-locate ewoc &optional pos guess
      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.
 
  -- Function: ewoc-location node
      This returns the start position of NODE.
 
  -- Function: ewoc-goto-prev ewoc arg
  -- Function: ewoc-goto-next ewoc arg
      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, whereas ‘ewoc-goto-next’ moves past
      the last node, returning ‘nil’.  Excepting this special case, these
      functions return the node moved to.
 
  -- Function: ewoc-goto-node ewoc node
      This moves point to the start of NODE in EWOC.
 
  -- Function: ewoc-refresh ewoc
      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.
 
  -- Function: ewoc-invalidate ewoc &rest nodes
      This is similar to ‘ewoc-refresh’, except that only NODES in EWOC
      are updated instead of the entire set.
 
  -- Function: ewoc-delete ewoc &rest nodes
      This deletes each node in NODES from EWOC.
 
  -- Function: ewoc-filter ewoc predicate &rest args
      This calls PREDICATE for each data element in EWOC and deletes
      those nodes for which PREDICATE returns ‘nil’.  Any ARGS are passed
      to PREDICATE.
 
  -- Function: ewoc-collect ewoc predicate &rest args
      This calls PREDICATE for each data element in EWOC and returns a
      list of those elements for which PREDICATE returns non-‘nil’.  The
      elements in the list are ordered as in the buffer.  Any ARGS are
      passed to PREDICATE.
 
  -- Function: ewoc-map map-function ewoc &rest args
      This calls MAP-FUNCTION for each data element in EWOC and updates
      those nodes for which MAP-FUNCTION returns non-‘nil’.  Any ARGS are
      passed to MAP-FUNCTION.