I had made some random notes in my scratch buffer.
By mistake, I pressed
C-x C-c and killed the Emacs session.
All my content in the scratch buffer was gone.
When I try to close Emacs when the scratch buffer had been edited, I want Emacs to ask for a confirmation (offer to save or something) before it exits the current session. How can this be done? I'm not conversant with eLisp.
I searched the manual and there seems to be no way to change this behaviour.
My question is not duplicate to the question "never close scratch" in that, the other user is referring to killing the scratch buffer intentionally using kill-buffer
C-x C-k. In my case, I unexpectedly exit out of Emacs either by closing the window or giving
C-x C-c command.