How rename a Tiddler?

196 views
Skip to first unread message

N P

unread,
Apr 24, 2020, 12:29:13 AM4/24/20
to TiddlyWiki
Hello,

I've been searching for a few days and came up short.  How do you rename a tiddler?  The documentation shows WidgetMessage tm-rename-tiddler, however that is destructive and leaves you with a fresh tiddler with a new name.

I've tried some variations of the below and came up short in my macro testing

<$action-setfield $tiddler="New Tiddler 2" $field="title" $value="New Name" />

My use case is, I have created a personal task management workflow. When I archive my tasks, I want to change the the Title of the Tiddler to a combination of Completed date field and Caption field.

Here is my archive button for reference

\define archiveHere()
$
(currentTiddler)$
\end


\define archiveHereButton(completed caption)
<$button tooltip={{$:/user/button/ArchiveTask/Hint}} class=<<tv-config-toolbar-class>> param=<<archiveHere>> >
<$action-listops $tiddler=<<archiveHere>> $tags="+[append[task-archive]]" />
<$action-setfield $tiddler=<<archiveHere>> title="$completed$ $caption$" />
{{$:/core/images/chevron-down}}</$button>
\end


<!-- 2020-04-24 call macro and pass the fields to concatenate as new title of task -->
<$macrocall $name="archiveHereButton" completed={{!!completed}} caption={{!!caption}}/>


Thank you,
Mick

Mohammad

unread,
Apr 24, 2020, 1:32:42 AM4/24/20
to TiddlyWiki
Think Tiddlywiki way! Why to change the title? You can
tag tiddler done, you can have a completion field and add your data there!
renaming a tiddler is not a good choice.

By the way, Eric Shulman has given the complete solution for renaming tiddlers here:


You can also use TW-Scripts

--Mohammad

N P

unread,
Apr 25, 2020, 8:37:43 AM4/25/20
to TiddlyWiki
Hi Mohammad,

While normally I would agree.  However, my task titles are simply the YYYY-MM-DD of the day I created them.  This is because I leverage the caption field to allow quick changes to the task name.
tasks.JPG



Once I archive my task, the assumption is no more edits will occur and I can file it.  So I change the name to a concatenation of `$completed$ $caption$`.  Now when I use TiddlyWiki's built in search textbox, the tasks show up with information and not just `YYYY-MM-DD`

Thank you for the link, I had no idea when I was changing the title, another tiddler was being created.  Here is what I have that will work.  I might try to include a prompt for myself to confirm the rename. This way I can see the empty tiddler before I copy into it and delete the original.

 $:/user/button/ArchiveTask
\define archiveHere()
$(currentTiddler)$
\end

\define archiveHereButton(completed caption)
<$button tooltip={{$:/user/button/ArchiveTask/Hint}} class=<<tv-config-toolbar-class>> param=<<archiveHere>> >
<!-- append archive tag -->

<$action-listops $tiddler=<<archiveHere>> $tags="+[append[task-archive]]" />
<!-- open the target tiddler that will be created during the rename-->
<$action-navigate $to="$completed$ $caption$" />
<!-- renaming tiddler will create a new one with existing content -->
<$action-setfield $tiddler=<<archiveHere>> title="$completed$ $caption$" />
<!-- delete the original -->
<$action-deletetiddler $tiddler=<<currentTiddler>> />

{{$:/core/images/chevron-down}}</$button>
\end

<!-- 2020-04-24 call macro and pass the fields to concatenate as new title of task -->
<$macrocall $name="archiveHereButton" completed={{!!completed}} caption={{!!caption}}/>

Mohammad

unread,
Apr 25, 2020, 9:07:56 AM4/25/20
to TiddlyWiki
Good luck N P, I see your code works now!

Cheers
Mohammad

PMario

unread,
Apr 25, 2020, 9:42:29 AM4/25/20
to TiddlyWiki
Hi N P

I did test the tm-rename-tiddler. ... It doesn't modify the "created" field. So it seems you did other commands, that created a new tiddler.

-m

PMario

unread,
Apr 25, 2020, 9:46:01 AM4/25/20
to TiddlyWiki
Just a reminder.

You shouldn't call action-widgets inside the button body. It should always look like this:

\define my-actions()
<$action-sendmessage $message="tm-home"/>
<$action-sendmessage $message="tm-full-screen"/>
\end

<$button actions=<<my-actions>>>
Click me!
</$button>

It saves you a lot of problems in the long run. Trust me.

Mat

unread,
Apr 25, 2020, 11:12:58 AM4/25/20
to TiddlyWiki
PMario wrote:
You shouldn't call action-widgets inside the button body. It should always look like this:  

\define my-actions()

Hm, the docs say either way is fine. Is a separate macro better practice, and why in that case?

Thanx

<:-)

N P

unread,
Apr 27, 2020, 10:19:13 AM4/27/20
to TiddlyWiki
@PMario, 

I actually tested tm-rename-tiddler and it was creating a new empty tiddler and erasing the From tiddler. This was in 5.1.20  However, I am testing it now and it is working fine. I've since upgraded to 5.1.22. All of the fields, contents, and dates are coming over to the newly renamed tiddler.  Its actually saving me lines of code.  I do not know if my original testing issues was due to my error though.

And I am also curious of learning why actions should not be in the button widget.

Using tm-rename-tiddler
\define archiveHere()
$
(currentTiddler)$
\end

\define archiveHereButton(completed caption)
<$button tooltip={{$:/user/button/ArchiveTask/Hint}} class=<<tv-config-toolbar-class>> param=<<archiveHere>> >
<!-- append archive tag -->
<$action-listops $tiddler=<<archiveHere>> $tags="+[append[task-archive]]" />

<$action-sendmessage $message="tm-rename-tiddler" from=<<archiveHere>> to="$completed$ $caption$" />

{{$:/core/images/chevron-down}}</$button>
\end

<!-- 2020-04-24 call macro and pass the fields to concatenate as new title of task -->
<$macrocall $name="archiveHereButton" completed={{!!completed}} caption={{!!caption}}/>

Using actions
\define archiveHere()
$
(currentTiddler)$
\end

\define archiveHereButton(completed caption)
<$button tooltip={{$:/user/button/ArchiveTask/Hint}} class=<<tv-config-toolbar-class>> param=<<archiveHere>> >
<!-- append archive tag -->
<$action-listops $tiddler=<<archiveHere>> $tags="+[append[task-archive]]" />
<!-- open the target tiddler that will be created during the rename-->
<$action-navigate $to="$completed$ $caption$" />
<!-- renaming tiddler will create a new one with existing content -->
<$action-setfield $tiddler=<<archiveHere>> title="$completed$ $caption$" />
<!-- delete the original -->
<$action-deletetiddler $tiddler=<<currentTiddler>> />
{{$:/
core/images/chevron-down}}</$button>
\end


<!-- 2020-04-24 call macro and pass the fields to concatenate as new title of task -->
<$macrocall $name="archiveHereButton" completed={{!!completed}} caption={{!!caption}}/>




PMario

unread,
Apr 27, 2020, 10:44:00 AM4/27/20
to TiddlyWiki
On Monday, April 27, 2020 at 4:19:13 PM UTC+2, N P wrote:
@PMario, 
 
And I am also curious of learning why actions should not be in the button widget.

hmmm, I did some tests with TW 5.1.22, and the behaviour, that I had in mind doesn't exist anymore. So you may safely ignore the comment.

have fun!
mario


Joshua Fontany

unread,
Apr 27, 2020, 6:39:19 PM4/27/20
to TiddlyWiki
If I remember correctly, the contents of the Button widget are cached, leading to instances where the button will remember an "old" value (if the value of a referenced tiddler field or variable has changed).

See Jeremy's explanation and the preferred syntax here:

Best,
Joshua F
Reply all
Reply to author
Forward
0 new messages