Crazy todo concept / replacing current tiddler's text

(Editing as I figured it out)
Took @CodaCoder’s code and added timestamp logging (and slightly reformatted)

\define todo-done(txt, log)
<$button class="tc-btn-invisible tc-tiddlylink" tooltip="$log$" style="color: inherit;";>🗹&nbsp;$txt$
  <$vars in="""<<todo-done "$txt$" "$log$">>""" out="""<<todo "$txt$">>""">
    <$action-setfield text={{{ [all[current]get[text]search-replace<in>,<out>] }}}/>
  </$vars>
</$button>
\end

\define todo(txt)
<$button class="tc-btn-invisible tc-tiddlylink" style="color: red;"> ☐&nbsp;$txt$
  <$vars out_base="""<<todo-done "$txt$" " """ out_time=<<now "YYYY-0MM-0DD hh:mm">> out_end=""" ">>"""  >
    <$vars in="""<<todo "$txt$">>""" out={{{ [<out_base>addsuffix[Completed: ]addsuffix<out_time>addsuffix<out_end>] }}}>
      <$action-setfield text={{{ [all[current]get[text]search-replace<in>,<out>] }}}/>
    </$vars>
  </$vars>
</$button>
\end

And (if gifs work here) this is what it looks like in action.
todos

Thanks again everyone!

1 Like

I had to rename some stuff to avoid clashes with mine…

\define todo-doneX(txt)
<$button class="tc-btn-invisible tc-tiddlylink" tooltip=<<now>> style="color:inherit;";>🗹&nbsp;$txt$
 <$vars in="""<<todo-doneX "$txt$">>""" out="""<<todoX "$txt$">>""">
  <$action-setfield text={{{ [all[current]get[text]search-replace<in>,<out>] }}}/>
 </$vars>
</$button>
\end

\define todoX(txt)
<$button class="tc-btn-invisible tc-tiddlylink" style="color: red;"> ☐&nbsp;$txt$
  <$vars in="""<<todoX "$txt$">>""" out="""<<todo-doneX "$txt$">>""">
    <$action-setfield text={{{ [all[current]get[text]search-replace<in>,<out>] }}}/>
  </$vars>
</$button>
\end


<<todoX "call the boss">>

Instead of passing timestamp around, I get it at the time the todo-done is created. I hope that does the trick you’re after…

Thanks for the help @CodaCoder! Your version is certainly cleaner. So that tooltip gets locked in until when? It seems like it might accidently “update” at some other point (during other future edits in another area of the same tiddler?) I’ll do some testing. Thanks!

I’m not sure about the locking in of the tooltip – if I’m following what’s going on, it’s kind of captured at the time (each time) the todo-done is created. IOW, todo doesn’t create one, only the transition from todo to todo-done makes a NEW timestamp.

It was nice to remove the log param.

Be interesting to have @EricShulman give it a lookover.

I do not understand. If I save and refresh, they all show the same time …NOW.

Ah!

Of course… dangers of working live and forgetting to come back and look.

So the timestamp needs to be off-loaded to a field somewhere via an <$action-setfield/> widget.

Good catch @Birthe !

I knew the date thing could get messy :man_shrugging:

@Birthe my version above stores the date in the macro, give it a spin!

@stobot Your version works, no change after refresh. I really like the date and time idea.

1 Like

To all for your consideration;
I like these solutions because they create perhaps what we may call a list of sub tasks. The thing about such lists in single tiddler is they can be generated from a tiddler template and can be used to build checklists in a complex process that you may do more than once, for example “register a domain, host it and start building a website”.

Existing features to keep in mind when doing this;

  • You can use the excise tool to insert macros rather than links/transclusions
  • You could make your own Editor Toolbar button
  • With the right process you could extract all such todo’s (macro calls) to summarise at the bottom or collate from multiple tiddlers in a single view. I would be keen to build a general solution for this.

Finally @pm, TT and I have on pause a project called “Custom Markup”, with custom markup it is trivial to introduce a format like this

Rather than
<<todo “call”>>
do
Must『t Call fred』this week

And it can replace during parsing the call fred with <<todo "call fred">>

Future directions;

As inspired by this thread however I think it would be great if say on tiddlers tagged todo all verbs were found were extracted as smart todo items automatically.

eg
To get the address details call fred!

would perhaps find the get or the call and generate a todo up to the “!”

To <<todo "get the address details call fred!">>

And you could also display icons such as a phone for the verb call.

1 Like

As we can see all verbs in English have past tense equivalents so on actioning “call” could become called.

“Call fred about a dog!”
Becomes
“Called fred about a dog!”

Then if we assume following the first verb is the subject “fred” we could also freelink to the “fred” tiddler if it existed.

A minor suggestion:

What do you think if all of the todos, listed at the top or bottom of tiddler? while you called todo whenever you liked

Hello. First of all, thank you very much for the code. I would like to report a bug (or unexpected behaviour).

With this code

\define todo-done(txt, log)
<$button class="tc-btn-invisible tc-tiddlylink" tooltip="$log$" style="color: inherit;";>🗹&nbsp;$txt$
  <$vars in="""<<todo-done "$txt$" "$log$">>""" out="""<<todo "$txt$">>""">
    <$action-setfield text={{{ [all[current]get[text]search-replace<in>,<out>] }}}/>
  </$vars>
</$button>
\end

\define todo(txt)
<$button class="tc-btn-invisible tc-tiddlylink" style="color: red;"> ☐&nbsp;$txt$
  <$vars out_base="""<<todo-done "$txt$" " """ out_time=<<now "YYYY-0MM-0DD hh:mm">> out_end=""" ">>"""  >
    <$vars in="""<<todo "$txt$">>""" out={{{ [<out_base>addsuffix[Completed: ]addsuffix<out_time>addsuffix<out_end>] }}}>
      <$action-setfield text={{{ [all[current]get[text]search-replace<in>,<out>] }}}/>
    </$vars>
  </$vars>
</$button>
\end

If I have two todos with exact same parameter

<<todo "call the boss">>
<<todo "call the boss">>

Clicking on the second todo will complete the first one.

@Pak That is expected, it would allow you to place the same todo item in a few places in your text and finishing one finished them all.

But stop and think, what this does!

Just because you can why would you?

<<todo "call the boss">>
<<todo "call the boss">>

actually mean? if you must

<<todo "call the boss">>
<<todo "call the boss again">>

or
<<todo "call the boss twice">>

It is only a problem if

<<todo "call the boss">>

Is used in the same tiddler more than once. It works totally okay, when used in another tiddler. I think that makes it easy to remember what we have used before.

Agreed, I specifically built it that way because the intent was to mark a few follow ups along the way, and most are tied to quick conversations with people. Most times then that conversation would knock a couple out together. So using the text after todo allows the flexibility of it being likely being solved multiple things at once (same text) or separate conversations (different text). To a point @TW_Tones brought up, I already have a summarizing area elsewhere that scrapes all lines with todos in them which is helpful when I have a day that’s literally all meetings.

For me the last piece is the quick shortcut where I can highlight the text, do ctrl-t or something and surround it like bold. I know I’ve seen how to do that somewhere, just need to find it.

I am not sure I understand you correctly. But if all you want is marking the text bold - we have the keyboard shortcuts in $:/ControlPanel. Mark the text and press Ctrl-B.

Sorry @Birthe , I meant to use that as an example but instead of surrounding the selected text with the wiki text denoting bold, it would surround it with the above macro.

So selecting call the boss would become <<todo "call the boss">>. I think a custom editor button can do it somehow along with the shortcut editor.

The first part of it the Editor Toolbar button look at the way @Dave Gifford did it in the

subsume plugin

@Mohammad you’re right - that’s important, though I have already implemented something similar in that I always have an open tiddler “Home” at the top that summarizes ALL notes item, so same effect, but across notes. In my case, I use multiple short tiddlers (one for each meeting), so this is preferable. If my workflow was instead just one per day, then the way you describe it would make more sense. When I finish the button thing, I’ll post everything back here as a package.

1 Like

Cross linking the related discussion, @stobot implementation of ideas, that were started here