Is it possible to change how TW numbers new tiddlers?

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.

hmm. I’m pretty sure new-lines in tiddler titles will cause problems.

I haven’t tested it for very long, but now that you mention it I imagine your likely right.

I was under the impression that the title field was removing the new line when inserting the count, however looking at it, that probably is not the case.

Also, I completely missed that! sorry about that, I wasn’t expecting that behavior.

:slight_smile: That’s why the docs at: https://tiddlywiki.com/#ActionCreateTiddlerWidget have this comment at the button

I think it does remove the backslash \ … But even if it does, it should not be there. … Who knows.

Well for the moment seems safe to use for just messing about, but ultimately bad practice in the long run.

Relying on unintended behaviors isn’t something I should get into the habit of doing, so back to the drawing board I go.

Would there be another method of setting the baseName to empty without causing an error?

Actually, nevermind- I’m not sure where my mind is at, but just setting the baseName to anything is fine, because as long as the template does not call it, and only calls the count, it sets it as a number

hmm … a space as a base name is only safe if you use trim[] with it. Like so.

\define testCreate()
<$action-createtiddler $basetitle={{{ [<unusedtitle baseName:" " separator:"" template:"$basename$$separator$$count:1$">trim[]] }}} />
\end

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