#!/bin/zsh

### Filter all but the first defer block.
#function __antidote_filter_defers {
  emulate -L zsh; setopt local_options $_adote_funcopts
  $__adote_awkcmd '
    # filter all but the first time we source zsh-defer (a 4 line if statement)
    BEGIN   { skip=0; found=0 }
    skip>0  { skip-- }
    /^if.+functions\[zsh\-defer\]/ { if(!found) found=1; else skip=4 }
    skip==0 { print }
  ' "$@"
#}
