fix-me-now
If you have a tree that's almost perfect, but you just need to, uh, "fix it up" a little, that's where this fix-me-now macro can be your friend.
It's a combination of strse* from the strse egg and pre-post-order-splice* from sxml-transforms.
The first argument is the tree you wanna fix, followed by zero or more matches and replacements (so an even number), followed by zero or one alist of tags and bindings.
The match and replacement works like strse* while the bindings use pre-post-order-splice* but has sane defaults for *default* and *text* (which you can still override).
(fix-me-now '(and (she buying) 1 stairway 2 heaven) "2 h" "to h" `((she . ,(fn (cons* x 'is y)))))
⇒ (and (she is buying) 1 stairway to heaven)
(fix-me-now '(a (b c (d e f))) "e f" "(e f)")
⇒ (a (b c (d (e f))))
Note that if you use any strse* operators, the tree will be written and re-read using write semantics, which will mess up any procedures and stuff you have in there. If you only use the pre-post-order-splice* binding alist, you don't need to worry about that.
Source code
git clone https://idiomdrottning.org/fix-me-now