view tools/foreach.m4 @ 1337:05ced4a389bf

Fix issue of mixing actions for initialiaztion with user actions - When user undo last actions, it also remove actions for initialization of a new document.
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 05 Feb 2011 13:46:07 +0800
parents f4b792afa74e
children
line wrap: on
line source

divert([-1])

define([_arg1], [$1])

define([_foreach], [ifelse([$2], [()], [],
[define([$1], _arg1$2)$3[]_foreach([$1], (shift$2), [$3])])])

define([foreach], [pushdef([$1])_foreach($@)popdef([$1])])

divert[]dnl