Overriding a macro?

89 views
Skip to first unread message

Rob Hoelz

unread,
May 8, 2017, 11:46:40 AM5/8/17
to TiddlyWiki
Hi TiddlyWiki users!

I was playing around with the new drag 'n' drop features from 5.1.14, and I was thinking of customizing the behavior of the list-tagged-draggable-drop-actions macro.  I could do this by creating a copy of the $:/core/macros/list tiddler, but I would rather just override the one macro.  After some experimentation, it seems that I can create a my own tiddler tagged with $:/tags/Macro that provides my custom implementation, and that will be used (as long as my tiddler follows $:/core/macros/list in the tag ordering), but I don't know if this "overridden macro" behavior is intentional or not.  Is this functionality I can rely on continuing to work, or should I shy away from doing things this way?

Thanks!

-Rob

Ton Gerner

unread,
May 8, 2017, 12:44:20 PM5/8/17
to TiddlyWiki
Hi Rob,

Nothing wrong with it.
See for example $:/core/macros/timeline. If you open it you will see:

<!-- Override this macro with a global macro
     of the same name if you need to change
     how titles are displayed on the timeline
     -->

Cheers,

Ton

Rob Hoelz

unread,
May 8, 2017, 1:53:44 PM5/8/17
to TiddlyWiki
Excellent, thanks for confirming Ton!

Ton Gerner

unread,
May 8, 2017, 2:22:13 PM5/8/17
to TiddlyWiki
Hi Rob,

But keep in mind:

Overridden shadow tiddlers can give problems when upgrading!
It is best to deactivate/delete the overridden shadow tiddler before upgrading. If required you can reapply the changes to the shadow tiddler after upgrading.

Cheers,

Ton

Rob Hoelz

unread,
May 8, 2017, 2:57:39 PM5/8/17
to TiddlyWiki
Ah, thanks for the warning!  Is there a way I could mark that tiddler as non-upgradable, other than prefixing it with $:/state or $:/temp?

Rob Hoelz

unread,
May 8, 2017, 3:09:27 PM5/8/17
to TiddlyWiki
Hmm...I just realized that since I'm on the Node platform, I can't rely on core/modules/upgraders to screen tiddlers for me.  I guess I just may need to be diligent!
Reply all
Reply to author
Forward
0 new messages