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)