AutoSaveSessionPlugin for TiddlyWiki

This is a plugin for TiddlyWiki. It saves the current open tiddlers to DefaultTiddler if the user clicks on Save Changes, so the next time you load your TiddlyWiki, it will show exactly the same tiddlers your had opened before including their order.

Note on DefaultTiddler

Please notice the fact, that this plugin will overwrite your DefaultTiddler every time you save the wiki. You will not be able to maintain it manually yourself.


Create a new empty tiddler, copy the code below into the textarea, give it a name, e.g. AutoSaveSessionPlugin and add the following tag: systemConfig. The latter is the most important part, because it tells TiddlyWiki that this specific tiddler is a plugin.

Save the tiddler, save the Wiki and reload it. From now on if you click on "Save Changes", your open tiddler list will be preserved.

Plugin Code

| Name|AutoSaveSession|
| Description|Saves the current open tiddlers to DefaultTiddler on saving TiddlyWiki|
| Version|1.0|
| Date|29.09.2008|
| Author|T.Linden|
| Email||
| License||
Saves the current open tiddlers to DefaultTiddler on saving TiddlyWiki

window.saveStory = function saveStory() {
        // get a list of open tiddlers and place them into DefaultTiddlers
	var tids=[];
	story.forEachTiddler(function(title, element) { tids.push("[["+title+"]]") } );
	var tid="DefaultTiddlers";
	var t=store.getTiddler(tid);
	var tags=t?t.tags:[];
	store.saveTiddler(tid, tid, tids,config.options.txtUserName, new Date(), tags, t?t.fields:null);
	displayMessage(tid+" has been "+(t?"updated":"created"));

// hijack the core function
// saveChanges(onlyIfDirty,tiddlers)
window.saveChanges_orig = window.saveChanges;
window.saveChanges = function(onlyIfDirty,tiddlers) {
	return saveChanges_orig(onlyIfDirty,tiddlers);