To edit a previous command line use the shell command fc (fix command) command.
fc -e editor -lnr first last
This will open the commands from the history list as specified in the range first to last. When you exit from the editor the command(s) will be run.
FCEDIT=emacs; export FCEDIT