How to avoid modifying wikimethod Javascript Tiddlers?

so, one of the changes I made a little while back to my TiddlyWiki was starting the count of the unusedtitled macro at 1, rather than 0, by modifying the $:/core/modules/wiki.js tiddler.

However, I really, really don’t like that in order to have this change work, I have to modify the core system tiddler.

I tried duplicating the tiddler with the name $:/wiki/modules/wiki.js and setting the field list-after to after the $:/core/modules/wiki.js, which has worked for another Javascript tiddler I’ve made changes to ($:/wiki/modules/widgets/checkbox.js) but unfortunately, this did not work.

Is there a way I can avoid having to change the wiki.js tiddler?

Sounds like a developer question. but is there some kind of module load field which you can place a value in to reorder?

I’m not sure, the JavaScript side of tiddlywiki is the wild west to me, I will check* TW.com and TW.com/Dev

Edit: From what I’ve looked through @TW.com/Dev, it doesn’t seem like it, looks like they are loaded I’m assuming alphabetically by $:/core/modules/startup/load-modules.js ?

I am unsure, unfortunately I am still very unfamiliar with JavaScript and how the microkernal works in TW

Hi @Justin_H it sounds like a reasonable way forward would be a PR that adds a new hidden setting for the unusedtitle starting count.

I’m curious about how it would be implemented :thinking:

Edit: I’ve submitted a new feature request

Though I can’t help but wonder if there’s a way to have JS tiddlers all work with the list-after field.

I’m not sure, what that means. The list-after field is used to define the sort-order of the list-filters.

IMO the problem may be, as soon as you do a manual drag&drop sort, all the list-before and list-after fields are physically removed from their tiddlers. – IMO that can cause problems. Technically it’s the right thing to do but if those tiddlers are shadow tiddlers, they are changed silently, which may cause an upgrade problem

@Justin_H – Please have a look at the GitHub issue!

@pmario Oops, sorry bout that, wasn’t seeing notifications for it on my phone :sweat_smile:

Ah, I was under the impression that the list after and list before worked different than how it does, as I found out after looking into it. For some reason I thought it changed the order of tiddlers in the parse tree, instead of reordering them in the list field of whatever they were tagged to.

I don’t know where I got that notion, but please disregard that concern of mine, I was very wrong :rofl:

1 Like

PR is on the way. add startCount to unusedtitle macro, new tests, new docs by pmario · Pull Request #7941 · Jermolene/TiddlyWiki5 · GitHub

GH contains a link to a preview page, where you can test the new function. Hope it works as expected.

1 Like

Awesome! I can’t wait to play with it, so far I’ve only noticed that in examples 1 it creates the tiddler but doesn’t bring it into the storyriver.

I look forward to the final version of it :grin:

That’s intentional for the examples. It switches the right sidebar to the Open tab, so you can see the tiddlers that are created.

The second example uses the actionsendmessage with tm-new-tidler, which does open the new tiddler in the story river in edit mode. The other examples use actioncreatetiddler, which does not automatically open the new tiddlers.

The preview does contain the final version of the <<unsuedtitle>> macro.

1 Like

Oh, I missed that, I’m glad it wasn’t a complication with adding the parameter.

Awesome :grin: