edex() {
  local fname="$(mktemp)"
  cat >"$fname"
  local epoch="$(mktemp)"
  trap 'rm "$epoch" >&/dev/null' RETURN ERR

  "$EDITOR" "$fname" >&2 || return 1

  # check mtime to ensure the editor has saved
  if [[ -s "$fname" && "$fname" -nt "$epoch" ]]; then
    # history -s ". $(printf "%q" "$fname")"
    printf >&2 "edex: commands are save to %q\n" "$fname"
    . "$fname"
  else
    printf >&2 "%s\n" "edex: File not saved, hence not run"
    return 1
  fi
}
