> var themeTiddler=store.getTiddler("MptwTheme");
> if (themeTiddler) { themeTiddler.text.replace(/
> closeTiddler/,"collapseTiddler collapseOthers closeTiddler"); }
>
> But this change becomes permanent on the next save so
> a) the macros keep being added on each save
> b) MptwTheme is now different from the original which is what I wanted
> to avoid in the first place.

You're almost there!  The trick is to make sure you match the text on
*both* sides of the content you want to insert.  That is, you want to
replace "toolbar closeTiddler" with "toolbar collapseTiddler
collapseOthers closeTiddler".  That way, the next time the document is
loaded, the "toolbar closeTiddler" pattern will no longer be matched,
and the changes won't be done a second time.  Thus:

var t=store.getTiddler("MptwTheme");
if (t) t.text.replace(/toolbar closeTiddler/,"toolbar collapseTiddler
collapseOthers closeTiddler");

With regard to (b), although it's true that the [[MptwTheme]] in your
document will be modified, this shouldn't present any real problems
when upgrading.  When you get an update to MPTW, [[MptwTheme]] will be
restored to it's default content, and then the above code 'tweak' will
be re-applied, since the "toolbar closeTiddler" pattern will once
again be present in the theme definition.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to