Command to show difference between a buffer and its corresponding file
EmacsDiffEmacs Problem Overview
Is there an emacs command to show the difference between a buffer and its file?
For example, I've made some edits to a buffer, forgotten what they were, and now I need to save the buffer to its file, but want to check what I have actually changed first.
Emacs Solutions
Solution 1 - Emacs
diff-buffer-with-file
. I just googled for "emacs compare buffer file changed".
Solution 2 - Emacs
Another option is to hit C-x s
followed by d
. This also shows a diff between a buffer and its file.
Most useful if the buffer of interest is the only one that needs saving.