So this is probably a weird question but out of muscle memory I tend to save files constantly. This becomes a slight inconvenience when I have a compilation buffer then accidentally save that. I was wondering if there was a way to disable saving a file or something for buffers like this. Thanks.
Something like this, perhaps:
(defun my-save-buffer (&optional arg)
"Like `save-buffer', but does nothing in certain modes."
(interactive "p")
(unless (derived-mode-p 'compilation-mode
'help-mode
;; etc...
)
(save-buffer arg)))
(global-set-key [remap save-buffer] #'my-save-buffer)
auto-mode-alist
) thenC-x C-s
asks you whether to save it. Is that what you're doing - confirming to save it? If so, what is it that you want Emacs to do, to prevent you from confirming? ;-) – Drew Jul 18 '18 at 4:41