Node:Tree-buffer How to, Previous:Do not with tree-buffer, Up:tree-buffer
This chapter describes in detail how to solve certain programming-challenges with tree-buffers.
Sometimes it can be useful or important to cache the current display of a tree-buffer and display later exactly this cached display-state. Here is how to do this:
tree-buffer-displayed-nodes-copy
. Then store the
buffer-contents of that tree-buffer you want to cache; you can do this
for example with buffer-substring
. For both tasks you must make
the tree-buffer the current-buffer.
tree-buffer-update
and pass as second argument CONTENT
the data you have stored in step 1. See the documentation of
tree-buffer-update
for details.
Here is an example:
(tree-buffer-update nil (cons (nth 2 cache-elem) ;; the stored buffer-string (nth 1 cache-elem) ;; the stored tree-structure )))