added prompt function and set emacs to ask before exit