$:/state use for own stuff?

UI settings of core TW is stored within $:/state/ but can I or must I use it for the settings of my own stuff, and how (convention-name-wise)?

And, the question could be extended to about all the core places.

I would recommend not to use the $:/core namespace for your own customizations as that would be misleading.

For the namespaces I mention below, I usually add a “sq/plugin-name” suffix when using them for my own modifications or plugins, for example $:/config/sq/streams/my-setting

Tiddlers prefixed with $:/state are special in that they are saved and persist after a wiki reload in single file TW, but not in TiddlyWiki on node.js.

Tiddlers prefixed with $:/temp are never saved in single file or node.js TW

Similarly changes to $:/temp and $:/state do not trigger the warning about unsaved changes when exiting the wiki.

The $:/config prefix is used for configuration settings.

1 Like

It depends. For functions that “touch” core $:/state/ tiddlers like $:/state/tab- $:/state/advancedsearch and so on, it makes sense to use them and modify them as needed. It doesn’t make sense to duplicate them for your own code. It would make the code much more complex

But if you need some states for your own code it’s preferred to use a “custom” prefix as Saq wrote. He uses /sq/ … Most of the times I use /wl/ where name clashes could happen.

For states at the moment I use $:/state/<plugin-name>/some-state … For consistency I should probably change that in the future. …


TiddlyWiki uses some internal class-names, variable-names and message-names that are prefixed with tc- for classes, tv- for variables and tm- for messages

If I need similar elements with the “same” or a “very similar” meaning I prefix them in my plugins.
eg: wltc-, wltv- and wltm- … So I can use the same “names” as the core but they are nicely separated.

eg: TW uses tc-tiddlylink to style links. If I need something additional, that is only compatible with my plugins I would use: wltc-tiddlylink … So other uses may still know, what it does, but there will be no name-clashes.

Thank you @saqimtiaz and @pmario for these precisions. I had already learnt about $:/temp here and used it. I shall take advantage of my new knowledge!

@jypre in reality you can always use qualify with the state prefix eg; <<qualify $:/state/descriptivename>> in this way you are even less likely to have your state tiddler duplicated with another, adding your “brand” reduces this further, I use PSaT for People, system and things so for the “info-tools” project, would use <<qualify $:/state/PSaT/info-tools>> for which I have tiddlers $:/PSaT/info-tools and subtiddlers, or $:/plugin/PSaT/info-tools

You may also like to have a look at TW-Scripts

When to Use Temp and When to Use State Tiddlers

1 Like