I sometimes would like to make changes to my emacs files but without changing the date of the modified file. For instance, I would like to write up a brief evaluation of a lecture I might have given. Ideally, I would not like to change the file's date under these circumstances. Is there any way to do this? I run emacs on Windows 7. I have noted too that changing a file's name also changes its date. It would be nice to change the name but without effecting the date.
I don't think you can avoid changing the timestamp when saving, but you could write a function that resets it back to the original pre-save timestamp:
(defun save-buffer-preserving-modtime () "Call `save-buffer', but keep the visited file's modtime the same." (interactive) (let ((original-time (visited-file-modtime))) (save-buffer) (set-file-times buffer-file-name original-time) (set-visited-file-modtime original-time)))