Reputation: 28372
In GNU Emacs I have a particular buffer *my-special-buffer*
which I create as the output of running a sub-process and storing the output. I mark this buffer as read only after filling the contents. Occasionally when I try to exit Emacs I notice that I am prompted to save this buffer:
Save file /foo/bar/.../*my-special-buffer*? (y, n, !, ...
Is there a buffer local variable I can set as part of the initialization of this buffer to prevent the save prompt from interrupting my attempt to shut down Emacs? Just to be clear, I don't want to save this buffer; the buffer's purpose is only to show read-only data from the sub-process.
Upvotes: 3
Views: 1748
Reputation: 28372
It looks like this is what I should set after filling in the buffer.
(set-buffer-modified-p nil)
More details here. After that, I make the buffer read only.
Upvotes: 3
Reputation: 60004
If you want to save all buffers when exiting without any questions at all, do C-u C-x C-c:
C-x C-c runs the command save-buffers-kill-terminal...
...With prefix ARG, silently save all file-visiting buffers, then kill.
If you want Emacs to think that the buffer should not be saved at all, all you need to do is to mark it as unmodified: M-~.
Upvotes: 1