typeset -A __MACROS
macro() {
    name=$1
    cmd=$(tail -n 2 $HISTFILE | head -n 1 | awk -F';' '{print $2}')
    escaped_cmd=${(@q)cmd}
    alias $name="eval $(echo $escaped_cmd)"
    kv=($name $escaped_cmd)
    __MACROS[$name]=$escaped_cmd
}

macros() {
    for key val in ${(kv)__MACROS}; do
      echo "$key -> $val"
    done
}

Ever have a really, really long command line and you wish that you could make an alias, but you’re too lazy to copy and paste?

$ cat Makefile | sort | uniq | tac
$ macro x
$ alias x
x='eval cat\ Makefile\ \|\ sort\ \|\ uniq\ \|\ tac'

Big missing feature is the ability to save these to a file.