Needed: a button to add a tag to all tiddlers

Hi all

What is a button I could use to add a tag to all my non-system tiddlers?

I am imagining something like the following, which of course doesn’t exist.

<$fieldmangler filter="[!is[system]]">
<$button message="tm-add-tag" param=".entry">Add tag</$button>
</$fieldmangler>

Would something like this work?

<$button>
	<$list filter="[!is[system]]" >
		<$set name="newTags" filter="[list[!!tags]] =[[.entry]]">
			<$action-setfield $tiddler=<<currentTiddler>> tags=<<newTags>> />
		</$set>
	</$list>
	tag tiddlers
</$button>

A variant using <$action-listops> widget:

<$button>
	<$list filter="[!is[system]]" >
		<$action-listops $tags="[[.entry]]" />
	</$list>
	tag tiddlers
</$button>

Tested on tiddlywiki.com, it works fast and doesn’t touch existing tags, just adds .entry.

Hope this helps,

Fred

[edit]: corrected tag spelling

Thanks @fastfreddy and @tw-FRed !

@DaveGifford I went down the same path once before. I just want to point out, depending on your situation, tagging all tiddlers with a given tag, is at least to start with the same as using the filter such as [!is[system]] or perhaps more precisely [all[tiddlers]!is[system]] unless you start to remove tags, or add other tiddlers “you do not tag”, it can be somewhat redundant.

  • That is you can just treat them as those returned by [all[tiddlers]!is[system]]
  • Then rather than remove tags to exclude them, just tag the ones you wish to exclude eg; [all[tiddlers]!is[system]!tag[excludetagname]]

I don’t expect this will be your case, but it was for me once or twice. It is not obvious at the start, but can be true depending on your plans.