If I run C-x C-c in emacs, it will close immediately. If I set confirm-kill-emacs to y-or-n-p it will ask for confirmation before closing.
Instead of y-or-n-p, I want to set some temporary timer for 3 seconds before closing emacs. So, if I press C-x C-c it should show something like
Emacs will be shutdown in 3 seconds. Press C-g to stop
If I don't do anything, it should shutdown emacs, but if I press C-g, it should prevent shutting down. How can I achieve this?