#!/bin/sh
# unemacs -- undo editing of a file with emacs
#
# AUTHOR: Gary T. Leavens

[ -n "$echo" ] && set -x

USAGE="Usage: $0 [file]"

if test $# -gt 1
then
	echo "$USAGE" >&2
	exit 1
fi

if test -r "$1.~1~"
then
    mv -f "$1.~1~" "$1"
else
    echo "ERROR: can't read file $1.~1~, so can't undo!" >&2
    exit 2
fi

