I know that if I set:
(setq confirm-kill-emacs 'y-or-n-p)
Emacs prompts me before I kill it.
But I want emacs to prompt me before I close my last gui frame (prompting me before killing any frame would be very helpful already). When you run emacs in daemon-mode, closing the last gui frame does not kill emacs and thus the aforementioned setting does not work.
The problem is that sometimes I overpress my keybind to quit emacs windows (
evil-quit) and I endup quiting also my current gui frame, which is annoying.
I know that before deleting the frame, emacs runs the functions that are listed in the variable
delete-frame-functions, so I thought I could include a function there that would prompt me to query if I really wanted to kill the frame. But it is not clear from the documentation what I would have to do inside that function to stop the process of killing the frame.
Another idea would be to add an advice to evil-quit, like: if daemon-p is
t then evil-quit have to prompt me to quit my current frame. Something like that?
I run GUI emacs from both OSx and GNU/Linux.