I activated setq-local confirm-kill-emacs (quote y-or-n-p)
on a hook for a local mode which has a shortcut very similar to C-x C-c
, in order to avoid accidentally closing Emacs when trying to execute the said shortcut. That way, Emacs will ask me to confirm it and I will be able to cancel it.
But this has an unfortunate consequence, that is, when I click on the close button on the top of Emacs' window, it also asks the same question. This is often annoying.
Is there a way to only ask for confirmation when using the keyboard shortcut, but not the mouse click?