5

In Emacs, how do I inspect what has been modified in a buffer (before saving and overwriting the file)?

(In a sense, the requested action is an analog of git status and git add -i showing what has been modified, only the comparison should be done between the buffer contents (in Emacs's memory) and the file on disk.)

Sometime, I forget what has been modified in a buffer, and would like to call a command to remind me.

2
  • Some people might even like to "bind" this behavior with the saving or killing-the-buffer command: so that the diff is demonstrated before one decides whether to save or kill the buffer (that's similar to the interactive way of how darcs record works). Commented Jun 17, 2014 at 22:44
  • The same question at Emacs.SE has more interesting answers. Commented Jan 24, 2015 at 10:01

1 Answer 1

8

M-xdiff-buffer-with-file

I've just found it by looking through files.el where I felt there is such a command:

View the differences between BUFFER and its associated file.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .