The typical workflow in other text editors is that you are presented with a blank window, to start typing into, and then when you exit the editor (or kill the buffer if applicable, close the window in some editors - in general any action that would normally prompt to save), if you have typed anything, it will prompt you to save modifications and prompt you for a filename if you answer yes.
Is there a way to replicate this workflow in Emacs - i.e., have a buffer that does not have a filename (the buffer name would be something like *unsaved file*, I suppose), but prompts to save?
Creating a buffer by typing an arbitrary name after C-x b results in a buffer that won't prompt to save.
kill-buffer-hook
to prompt you for specifying the file to write the contents to, however you'd need to be careful about it: from Emacs standpoint there is no difference between a buffer you create by typingC-x b
and many other technical buffers created by programs which run in Emacs. So, maybe you'd need to design a command for creating a new buffer with this hook set up.C-x C-s
OCD if you like) and this would cause the file to be created with the random name I typed first. The other reason is because when usingM-x compile
or other such commands (which internally runsave-some-buffers
), you're always prompted to save any modified buffer associated to a file.C-x b
for temp buffers andC-x C-f
for stuff I might want to save. Personal works flows vary, of course!