SearchKeepTiddlersPlugin for TiddlyWiki

This is a plugin for TiddlyWiki. It preserves the current open tiddlers and opens matching tiddlers on top of them, so that you don't have to re-open all needed tiddlers after searching for something.

The plugin just overwrites the original search function and removes the call to this.closeAllTiddlers().

Installation

Create a new empty tiddler, copy the code below into the textarea, give it a name, e.g. SearchKeepTiddlersPlugin 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 search for something, all open tiddlers will remain open.

Plugin Code

/***
| Name|SearchKeepTiddlers|
| Description|Keeps the current displayed tiddlers open|
| Version|1.0|
| Date|30.05.2009|
| Author|T.Linden|
| Email||
| License|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!!Description
!!!Notes

!!!Code
***/
//{{{

Story.prototype.search = function(text,useCaseSensitive,useRegExp)
{
	highlightHack = new RegExp(useRegExp ?	 text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");
	var matches = store.search(highlightHack,"title","excludeSearch");
	this.displayTiddlers(null,matches);
	highlightHack = null;
	var q = useRegExp ? "/" : "'";
	if(matches.length > 0)
		displayMessage(config.macros.search.successMsg.format([matches.length.toString(),q + text + q]));
	else
		displayMessage(config.macros.search.failureMsg.format([q + text + q]));
};

//}}}