Is it possible to change how TW numbers new tiddlers?

I’m curious if there is a way to change the automatic titling of tiddlers with the same name, i.e. on a fresh edition, hitting the new tiddler button twice to get New Tiddler and New Tiddler 1 (which I would like to personally change to starting at 2 and counting up…)

Or, having the possibility to setting the title to just 0 and with each new tiddler, it starts numbering them up, instead of 0 1 turning it to 1. (or just any number format, like how you can pick the date format)

This is possible and I have done it, you need to modify, what it is, that creates the tiddler;

  • Make your own new tiddler button and design as you wish
  • Modify the New Tiddler (page control) new hear (viewToolbar button) etc…

Remember when you end up with two numbers at the end, such as with “new here” you have most likely made a new tiddler from a previous new tiddler, not from the original. It is important to see this is what you have done. Consider this in your design.

  • If you want to change this behaviour you need to provide the tm-new-tiddler message or CreateTiddlerWidget with the new title that obeys your rule, as long as the tiddler does not exist, it wont use the automatic increment (It can use yours).
    • Retaining the automatic tiddler increment for when a name is not unique is a good safety measure.
  • Over recent versions additional features have being made available that will help in this case such as the unusedtitle Macro

My recommendation is don’t change the existing buttons,

  • just provide new ones with the different behaviour you want, If you must;
  • you can clone the existing ones and modify them
  • Hide the originals behind the more dropdown, uncheck originals in the Control Panel > Appearance > Toolbars and check your new ones to appear instead.

@TW_Tones,

This would be the part I’m having a bit of trouble with, as I can’t find where tm-new-tiddler is located at to clone and modify.

I agree, and would like to use this for automatically titling tiddlers rather than removing it. Having the option to start a fresh TW and either setting the tiddlers title as “4” or just hitting the new tiddler (or custom made btn) when a tiddler titled “3” already exists.

That’s a good call, it’s what I’ve done in the past with other modified buttons.

  • Which button(s) are you using?, that is where to start.
  • See Advanced Search > Shadows and search for “button” or better [all[tiddlers+shadows]prefix[$:/core/ui/Buttons]] in the filter tab
  • eg $:/core/ui/Buttons/new-tiddler
    uses actions={{$:/core/ui/Actions/new-tiddler}}
    • $:/core/ui/Actions/new-tiddler relies on the default behaviour of tm-new-tiddler
    • So instead identify the title you want to be used and give it in the tm-new-tiddler param
      <$action-sendmessage $message="tm-new-tiddler" param=<<yourtitle>> tags=<<get-tags>>/>
  • This sounds like the default behaviour so I am not sure what you mean.
1 Like

Ah, sorry I was might of been mistaken from using the $:/language/DefaultNewTiddlerTitle text input field in the $:/ControlPanel where if you name it something with a number in it, it won’t consider it for future tiddlers.

I’ve been using the new-tiddler btn for reference, and have a few tiddlers made up how I want them.

My only question left is, how could I modify the tm-new-tiddler action message to start counting at 2, rather than 1?

Edit:

Actually instead- is there just a way to change the behavior of the $:/ControlPanel field for $:/language/DefaultNewTiddlerTitle to account for numbers already set for the Default Title?
I imagine this might also require modifying the tm-new-tiddler action message.

That would be a crude and technical way, modifying a core tiddler when you do not have to.

I recommend the way I suggested

  • I will give a working example if I can :nerd_face:
1 Like

Ok, I would appreciate it, as I don’t neccesarily know what to do with the param :sweat_smile:

Have a closer look at the unused-title macros in the docs

I’m not quite sure how to use this, but the $count$ string (which I think is different from the $count:0$ string, but not sure how to call it) looks exactly like what I’m looking for.

I imagine I would need to use this to change $:/core/ui/ControlPanel/Basics and the new tiddler btns ?

It’s not a variable, just a formatting info. … There are example tiddlers with a try-it button. Just play with the settings and you’ll see how it works.

BUT … It will never start with 2 … But you could probably use it as an example and create your own macro which will start with whatever you want.

On the other hand the whole OT does not make too much sense to me. “New Tiddler” And “New Tiddler 1” should not live long enough to get to “New Tiddler 2” … They are only there that you don’t overwrite existing content. …

Tiddlers should be named immediately with reasonable titles, otherwise you’ll have to do work 2 times which imo is a waste of time.

Well my idea was a button to set the tiddler name as a number without the need to actually name them, like book page numbering, or an automatically numbering zettelkasten, where all the context for what it is could come from tags and fields, without a need for a unique title.

Something like importing the button to a blank tiddlywiki, and each new tiddler would be titled “1” and then “2” etc.

As for the starting the count at two, I just thought it a bit odd that a tiddler that has a duplicate number would start with 1. “New tiddler” and then “new tiddler (numder) 2” (its not that important though.)

This is where I ran into the issue of setting a DefaultTiddlerTitle of a number, or blank, and when the tiddler generated was something like “1 1” and “1 2”

It is clear this is already causing confusion because you say "generated was something like “1 1” and “1 2”.

  • I was off the air in my time zone but I am back
  • I can make what you ask but like @pmario I do question why you want to do this (with all due respect)

This is being discussed in the replies below this one What is in a tiddler? tiddler types and how we handle them - #5 by TW_Tones

Perhaps we can look at modifying the new hear and clone buttons so they generate new tiddler titles based on the original tiddler, not the default new tiddler name or simple increment?

Also as you say here;

  • I think we can help you get this independently from the default tiddler titles.
  • We could all this “automatic titles” but I expect not all new tiddlers need or can have one of these “automatic titles” so we must retain something close to the normal behaviour.

I would be inclined to call this “new in context”

I propose;

  • We clone the new tiddler here button and wrap it in a condition that tests if one or more of the context fields eg book/chapter/section have a value
    • The Button will only appear if you are editing a tiddler with the context
  • We then rewrite this new button to include the current tiddlers context fields in the new tiddler.
  • We use the values in the context fields to construct a unique new tiddler title as in requested in this Topic.
  • To create a new sibling rather than child use the clone button
    • We can create a modified clone button that uses the context to make the automatic title as well.

Thus you can create tiddlers with a title based on the nominated context. Whilst retaining the context information in the new tiddlers fields (so you do not need to parse the title to determine the context)

Shall I do this?

  • I will eventually do this for myself
  • I hope to make it easy to clone and use alternate “context” fields and auto-generated titles.

If it will prove useful to you as well then I would give it the thumbs up, but its totally up to you- as I’m afraid its out of my level of know-how at this point.

I think mainly what would help is TW recognizing a number already in the title and counting up from it, from there it could do that for all other fields too.

Given the automatic name will start with the combination of “context fields” it would first create a title without a number, then with 1 then 2 …

  • We could consider an option to start with 1
  • If you then open one of these “in context tiddlers” ending in a number, and create a new one the new one may include the “parent” in the context.

Examples of context

  • Domain eg home work
  • Project project name
  • Tiddler type eg task reference contact

In the below assume the domain/project/tiddler type exist

New tiddlers in a tiddler with only Domain = Home

  • Home 1
  • Home 2

clone to make new domain
Option to create new project or task for Home domain here

New tiddlers in a tiddler with Domain = Home, Project = Building

  • Home Building
  • Home Building 1
  • Home Building 2

Clone to make new project in Home domain
Option to create new task for Home domain/building project here

New tiddlers in a tiddler with Domain = Home, Project = Building, tiddler type = task

  • Home Building taskname
  • Home Building taskname 1
  • Home Building taskname 2

Perhaps

  • We could start with “tiddlername 1”?

I’m not entirely sure I follow, but I think I understand.

My initial idea was a tiddler “0” where you would use it as a directory tiddler, and all newer tiddlers would be “1” “2” etc. and you wouldn’t need to worry about titling them, and instead put your focus on quickly getting down your thoughts, and using fields for context, such as a field:tiddler-topic, field:topic-type, and field:topic-status, with each enlist’ed to allow you to give multiple of each if needed.

Your Domain, Project, Type structure reminded me of this, however I think it follows a different train of thought that I haven’t fully grasped yet, but going on from your post, a tiddler starting at 1 wouldn’t be a problem, so long as TW recognizes the number in the title and doesn’t decide to name the next tiddler “tiddlername 1 1” as I have encountered.

It was mentioned above that you can achieve this using the unusedtitle macro, but I wasn’t able to figure out how following my tinkering with the try it buttons on TiddlyWiki.com

Unfortunately I have to head to sleep for work, but will return to this in the morning after my meetings, I look forward to picking this back up.

1 Like

I think we could get the new hear and clone buttons to first remove the " n" from the end before incrementing the title, then this double number will disappear.

  • I will think about that a little more.

Sweetdreams :nerd_face:

1 Like

I don’t know, why everything needs to be tackled creating walls of text.

Open the ControlPanel : Title of new tiddlers: and add this

<<unusedtitle baseName:"test" separator:"-" template:"$basename$$separator$$count:4$">>

and your new tiddlers have a base name of test and the rest will count. done.

The same mechanism can be used with the action-createtiddler action where the basename will get the macro as a parameter.

eg:

\define testCreate()
<$action-createtiddler $basetitle=<<unusedtitle baseName:"test" separator:"-" template:"$basename$$separator$$count:4$">> />
\end

<$button actions=<<testCreate>> >
Create Tiddler
</$button>
2 Likes

Ah, I didn’t realize you could put the macro into the text input and have it function, that’s really neat.

I found a method to do what I wanted by changing it to
<<unusedtitle baseName:"\n" template:"$count:1$">>

Also, sorry @pmario :sweat_smile: I like to put a good bit of text, I can cut down on the characters haha

Also sidenote, I was unable to get your button to function in a empty edition of TW.

The button works. You need to open the right sidebar : Recent tab to see the new tiddler. They are not edited by default. There is an other thread, which discusses this behaviour.