How to export / import $:/state tiddlers -- Folded states in particular

I would love that for the update process too! Each time I update my wikis I’m so upset to loose the state tiddlers, especially the folding state of tiddlers…

Fred

You can export your tiddlers prefixed $:/state/folded/ and then import them again. My bundler-plugin allows you to create a filtered-bundle, with which it would be easy to manage such a task.

folded-states-filtered.bundle.json (269 Bytes)

3 Likes

We could also drag these to a bookmarklet

But perhaps changing the save filter to include them is the best way

  • Append +[prefix[$:/state/folded/]] to the end of $:/config/SaverFilter
  • Note Excludes “fold all” but survives “unfold all”.

[Edited] See Erics correction below

$:/config/SaverFilter is used to determine whether the current loaded TW is “dirty” (i.e., needs saving). However, it isn’t actually used to control what gets saved. For that, you need to look in $:/core/save/all, which contains the following macro definition:

\define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]]
-[status[pending]plugin-type[import]] -[[$:/boot/boot.css]]
-[type[application/javascript]library[yes]] -[[$:/boot/boot.js]]
-[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
\end

Note that this filter definition includes [is[tiddler]], and then excludes -[prefix[$:/state/popup/]]. But it does NOT exclude $:/state/folded so those tiddler ARE automatically saved in the file.

In contrast, when you are upgrading a TiddlyWiki (via https://tiddlywiki.com/upgrade), all $:/state/... tiddlers are unchecked by default, but can be selected via individual checkboxes (or by selecting all tiddlers via the checkbox next to the “Select” heading in the table) so that they are included in the resulting upgraded file.

2 Likes

I made that mistake once before thanks.

Yea, the names of those system tiddlers are a bit misleading. There’s the docs. https://tiddlywiki.com/#SavingMechanism