Remotely modifying macros?

32 views
Skip to first unread message

Mat

unread,
Sep 25, 2019, 3:40:13 AM9/25/19
to TiddlyWikiDev
Tonys idea to add hooks to buttons (at least that's my interpretation) gave me an idea. I'm just throwing this out there to hear if it makes sense at all:

Would it be useful to be able to remotely modify macros? Kind of the equivalent to this (pseudo code, no complaining):

\define mymacro({{mymacroparams}}) {{mymacrobody}}

or perhaps

\define mymacro({{{ [tag[mymacroparams]] }}}) {{{ [tag[mymacroparams]] }}}

It would enable customizing macros without overwriting their tiddler (e.g core tids).

Does this idea make sense?


<:-)

TonyM

unread,
Sep 25, 2019, 7:58:42 AM9/25/19
to TiddlyWikiDev
Mat

I have started doing something similar where I have a config tiddler who's value I can change but golbal macros that use the value in there definition, effectively providing a variable that matches the config tiddlers value. This allows one to avoid state tiddlers or config tiddler names being coded which is easy to read and can be locally overridden with a new set widget and the same variable name, if desired without changing the config tiddler.

As I read your suggestion you want to be able to alter the parameters as well. To be of practical use the two transclusions in your example will need to be related because one defines the parameters the second uses the parameters.

You could already create a button that adds a tiddler tagged as a macro with the text constructed from your transclusions into a macro definition. The newly defined macro is immediately available for use anywhere in the wiki.

You can see here that a lot is possible already but to achieve it you must have a trigger to do it. In this case a button. Hence my desire to add actions to existing core buttons and the on open tiddler navigation. You could get your dynamic macro definition to be triggered by one of the existing buttons so you do not need a separate trigger.

An example may be on opening a project tiddler set a current project macro equal to that tiddlers project name. On closing reset it. This would allow you to write project handling tiddlers that respond to the current tiddler.

Regards
Tony

Reply all
Reply to author
Forward
0 new messages